{"action":"created","issue":{"url":"https://api.github.com/repos/Pylons/pyramid/issues/2171","labels_url":"https://api.github.com/repos/Pylons/pyramid/issues/2171/labels{/name}","comments_url":"https://api.github.com/repos/Pylons/pyramid/issues/2171/comments","events_url":"https://api.github.com/repos/Pylons/pyramid/issues/2171/events","html_url":"https://github.com/Pylons/pyramid/pull/2171","id":121401581,"number":2171,"title":"config.add cache buster","user":{"login":"mmerickel","id":487237,"avatar_url":"https://avatars.githubusercontent.com/u/487237?v=3","gravatar_id":"","url":"https://api.github.com/users/mmerickel","html_url":"https://github.com/mmerickel","followers_url":"https://api.github.com/users/mmerickel/followers","following_url":"https://api.github.com/users/mmerickel/following{/other_user}","gists_url":"https://api.github.com/users/mmerickel/gists{/gist_id}","starred_url":"https://api.github.com/users/mmerickel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmerickel/subscriptions","organizations_url":"https://api.github.com/users/mmerickel/orgs","repos_url":"https://api.github.com/users/mmerickel/repos","events_url":"https://api.github.com/users/mmerickel/events{/privacy}","received_events_url":"https://api.github.com/users/mmerickel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-10T04:46:55Z","updated_at":"2015-12-10T19:11:19Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Pylons/pyramid/pulls/2171","html_url":"https://github.com/Pylons/pyramid/pull/2171","diff_url":"https://github.com/Pylons/pyramid/pull/2171.diff","patch_url":"https://github.com/Pylons/pyramid/pull/2171.patch"},"body":"Remove `cachebust=` from `config.add_static_view` and provide a `config.add_cache_buster` API. The cache busters are tied directly to raw asset paths instead of high-level specifications. For example:\r\n\r\n```python\r\nconfig.add_static_view('static', 'myapp:static')\r\nconfig.override_asset('myapp:static/', 'theme:static/')\r\n\r\ndef cb(pathspec, subpath, kw):\r\n    # pathspec -> 'theme:static/foo.png'\r\n    # subpath -> 'foo.png'\r\n    # kw -> args to route_url\r\n    return subpath, kw\r\nconfig.add_cache_buster('theme:static', cb)\r\n```\r\n\r\nNote that the cache buster is tied to `theme:static` and not `myapp:static`.\r\n\r\nI'm open to tweaking this API. For example, it might be more intuitive to tie the cache busters to the high-level specs in many cases. Perhaps it would be a better default to tie things to the high-level spec and provide an option to add_cache_buster such as `base_spec=True` or `raw_spec=True` for scenarios where the cache buster is a manifest tied directly to the specific assets. I don't think this would be very difficult to support and it'd be better to get a sane default to start with versus trying to change it. The advantage of using a high-level spec by default is that it would encompass overrides without having to add new cache busters per override.\r\n\r\nThis PR also drops the entire matching side of the cache busting and focuses purely on generating urls, allowing custom tweens, etc to serve the urls as they see fit.\r\n\r\nFixes #2145.\r\n\r\nping @mcdonc @bertjwregeer @dstufft "},"comment":{"url":"https://api.github.com/repos/Pylons/pyramid/issues/comments/163721536","html_url":"https://github.com/Pylons/pyramid/pull/2171#issuecomment-163721536","issue_url":"https://api.github.com/repos/Pylons/pyramid/issues/2171","id":163721536,"user":{"login":"dstufft","id":145979,"avatar_url":"https://avatars.githubusercontent.com/u/145979?v=3","gravatar_id":"","url":"https://api.github.com/users/dstufft","html_url":"https://github.com/dstufft","followers_url":"https://api.github.com/users/dstufft/followers","following_url":"https://api.github.com/users/dstufft/following{/other_user}","gists_url":"https://api.github.com/users/dstufft/gists{/gist_id}","starred_url":"https://api.github.com/users/dstufft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dstufft/subscriptions","organizations_url":"https://api.github.com/users/dstufft/orgs","repos_url":"https://api.github.com/users/dstufft/repos","events_url":"https://api.github.com/users/dstufft/events{/privacy}","received_events_url":"https://api.github.com/users/dstufft/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T19:11:19Z","updated_at":"2015-12-10T19:11:19Z","body":"Oh, and does this do away with the automatically setting a +10 year expiration on cache busted files, or does that still happen? I think that could work very well with if cache busters are using the real asset specs instead of the high level ones, it'd let you have the cachebuster decide on a url by url basis if it gets the super long expires or not (returns a ``None`` or an extra boolean or something to specify if it's being cache busted or not)."}}