-
Notifications
You must be signed in to change notification settings - Fork 2
Adding http_cache parameter to @viewconfig functions #214
Conversation
|
||
|
||
@view_config(route_name='callback') | ||
@view_config(route_name='callback', http_cache=DEFAULT_CACHE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a mistake here. Don't merge yet.
Now fixed....
…ue equal to zero
3286e92
to
58c9c90
Compare
@@ -106,12 +110,14 @@ def logout(request): | |||
raise httpexceptions.HTTPFound(location=redirect_to) | |||
|
|||
|
|||
@view_config(route_name='options', request_method='OPTIONS', renderer='string') | |||
@view_config(route_name='options', request_method='OPTIONS', | |||
renderer='string', http_cache=DEFAULT_CACHE) | |||
def options(request): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to have the @authenticated_only decorator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this needs to be available at any url and whether you're authenticated or not. Looking at the commit message "Respond to OPTIONS with CORS headers" it was about letting webview use authoring api.
Changes Unknown when pulling 58c9c90 on no_caching_for_authenticated_views into * on master*. |
@@ -36,6 +36,10 @@ | |||
from .storage import storage | |||
from . import utils | |||
|
|||
NO_CACHE = (0, {'public': True}) | |||
TIMED_CACHE = (datetime.timedelta( | |||
weeks=1, days=0, hours=0, minutes=0, seconds=0), {'public': True}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like this is used anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't. I thought that it would be good to keep in a TIMED_CACHE example just in case it proved useful in the future. We can take it out if you think it'll just be distracting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can leave it in - probably want to set some non-zero caching at some point.
Changes Unknown when pulling 58c9c90 on no_caching_for_authenticated_views into * on master*. |
Changes Unknown when pulling 58c9c90 on no_caching_for_authenticated_views into * on master*. |
…views Adding http_cache parameter to @viewconfig functions
"When you supply an http_cache value to a view configuration, the Expires and Cache-Control headers of a response generated by the associated view callable are modified. The value for http_cache may be ... zero (0). If the value is zero, the Cache-Control and Expires headers present in all responses from this view will be composed such that client browser cache (and any intermediate caches) are instructed to never cache the response."
- pyramid view configuration documentation
All
@authenticated_only
functions have been set to NO_CACHEFixes #206