diff options
| author | Michael Merickel <michael@merickel.org> | 2015-02-17 11:39:29 -0600 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2015-02-17 11:39:29 -0600 |
| commit | 75f85c57e0f4d1069cef9feb6ab6182b5f651492 (patch) | |
| tree | 039ca762ddcf6e4946a2570136927d2773374969 /docs | |
| parent | 6ea099ded65ff671c26753b9b30e4d19b3c47b81 (diff) | |
| parent | 5fdf9a5f63b7731963de7f49df6c29077155525f (diff) | |
| download | pyramid-75f85c57e0f4d1069cef9feb6ab6182b5f651492.tar.gz pyramid-75f85c57e0f4d1069cef9feb6ab6182b5f651492.tar.bz2 pyramid-75f85c57e0f4d1069cef9feb6ab6182b5f651492.zip | |
Merge pull request #1583 from Pylons/fix.remove-cachebust-tokens
remove the token from the ICacheBuster api
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api/static.rst | 6 | ||||
| -rw-r--r-- | docs/narr/assets.rst | 15 |
2 files changed, 14 insertions, 7 deletions
diff --git a/docs/api/static.rst b/docs/api/static.rst index 543e526ad..b6b279139 100644 --- a/docs/api/static.rst +++ b/docs/api/static.rst @@ -9,6 +9,12 @@ :members: :inherited-members: + .. autoclass:: PathSegmentCacheBuster + :members: + + .. autoclass:: QueryStringCacheBuster + :members: + .. autoclass:: PathSegmentMd5CacheBuster :members: diff --git a/docs/narr/assets.rst b/docs/narr/assets.rst index fc908c2b4..d6bc8cbb8 100644 --- a/docs/narr/assets.rst +++ b/docs/narr/assets.rst @@ -446,19 +446,20 @@ In order to implement your own cache buster, you can write your own class from scratch which implements the :class:`~pyramid.interfaces.ICacheBuster` interface. Alternatively you may choose to subclass one of the existing implementations. One of the most likely scenarios is you'd want to change the -way the asset token is generated. To do this just subclass an existing -implementation and replace the :meth:`~pyramid.interfaces.ICacheBuster.token` -method. Here is an example which just uses Git to get the hash of the -currently checked out code: +way the asset token is generated. To do this just subclass either +:class:`~pyramid.static.PathSegmentCacheBuster` or +:class:`~pyramid.static.QueryStringCacheBuster` and define a +``tokenize(pathspec)`` method. Here is an example which just uses Git to get +the hash of the currently checked out code: .. code-block:: python :linenos: import os import subprocess - from pyramid.static import PathSegmentMd5CacheBuster + from pyramid.static import PathSegmentCacheBuster - class GitCacheBuster(PathSegmentMd5CacheBuster): + class GitCacheBuster(PathSegmentCacheBuster): """ Assuming your code is installed as a Git checkout, as opposed to as an egg from an egg repository like PYPI, you can use this cachebuster to @@ -470,7 +471,7 @@ currently checked out code: ['git', 'rev-parse', 'HEAD'], cwd=here).strip() - def token(self, pathspec): + def tokenize(self, pathspec): return self.sha1 Choosing a Cache Buster |
