-
Notifications
You must be signed in to change notification settings - Fork 889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
backport config.add_cache_buster #2186
Conversation
806f7fa
to
45a1269
Compare
backport config.add_cache_buster
I try to upgrade pyramid without any success...
But the |
@sbrunner |
Then this mean that with pull request it's not anymore possible to have a cache buster based on a folder, the only one who relay fix the cache issue... |
Sorry I honestly have no idea what you're saying. Cache busters are tied to folders. Your original code with the version = uuid.uuid4().hex
def version_cache_buster(request, subpath, kw):
return (version + "/" + subpath), kw
config.add_static_view(name='static', path='mypackage:static')
config.add_cache_buster('mypackage:static', version_cache_buster) If the files are not actually named |
Ok, I understand and effectively with the asset override I try to fix the 404 error... We solved our problem precariously with the following simple cache buster:
Where the Then when we use the Wow to do it with the new version? If it's not possible for us it's a big regression (we use the alpha release just for the path segment based cache buster...). @chrisrossi you made the original version of the cache control, what do you think about it? It it's not anymore possible we should find an other solution outside pyramid... |
@sbrunner did you read the new section in the docs on Cache Busting? (Note the version number in the URL.) There are examples for both query string and path segment cache busting, as well as a discussion of various strategies. |
@sbrunner The match() concept that turned cachebusted URL's back into non-cachebusted paths was extremely fragile and unless used in a very specific manner it would break for all but the simplest use cases, and did not work correctly with asset overrides. To solve your issue, you could write a tween that turned the cache busted URL back into the non-cache busted URL before it entered the routing machinery. This will depend highly on your cache buster and what it does with the path. At the moment we consider the static view turning the cache busted URL's back into non-cache busted URL's outside of the scope of Pyramid due to the complexities surrounding it. |
@stevepiercy At the moment we don't document how to go from cache busted back to non-cache busted so that the static view can do it's thing. It's an assumption that the path returned from the cachebuster will match a physical file on disk. Thing is, there is no good way to do the reverse without dictating very specific ways in which a cachebuster could do it's work, something we avoided doing. Many people use asset pipelines that will modify the file names on disk to match the cachebusted name, and they would have no such problems. |
Thanks @bertjwregeer I just make something working :-) |
@bertjwregeer I had asset pipelines in mind, as discussed on the 1.6-branch cachebusting docs. But, yeah, probably not what @sbrunner wanted. @sbrunner would you be willing to write up a reproducible example of what you did to make it work for you? It might be a good Pyramid Cookbook recipe. I help out with writing docs. |
What I finally do is something like
|
Backporting changes from #2171 into 1.6.