diff --git a/cnxauthoring/views.py b/cnxauthoring/views.py index 7c2eec5..dbf4379 100644 --- a/cnxauthoring/views.py +++ b/cnxauthoring/views.py @@ -36,6 +36,7 @@ from .storage import storage from . import utils +NO_CACHE = 0 logger = logging.getLogger('cnxauthoring') @@ -81,10 +82,10 @@ def login(request): if request.unauthenticated_userid: return httpexceptions.HTTPFound(location=redirect_to) request.session.update({'redirect_to': redirect_to}) - request.authenticated_userid # triggers login + request.authenticated_userid # triggers login -@view_config(route_name='callback') +@view_config(route_name='callback', http_cache=NO_CACHE) @authenticated_only def callback(request): # callback must be protected so that effective_principals is called @@ -111,7 +112,8 @@ def options(request): return '' -@view_config(route_name='user-search', request_method='GET', renderer='json') +@view_config(route_name='user-search', request_method='GET', + renderer='json', http_cache=NO_CACHE) @authenticated_only def user_search(request): """Search for openstax accounts users""" @@ -134,7 +136,8 @@ def user_search(request): return result -@view_config(route_name='profile', request_method='GET', renderer='json') +@view_config(route_name='profile', request_method='GET', + renderer='json', http_cache=NO_CACHE) @authenticated_only def profile(request): return UserSchema().bind().deserialize( @@ -161,7 +164,8 @@ def update_content_state(request, content): pass -@view_config(route_name='user-contents', request_method='GET', renderer='json') +@view_config(route_name='user-contents', request_method='GET', + renderer='json', http_cache=NO_CACHE) @authenticated_only @storage_management def user_contents(request): @@ -222,7 +226,8 @@ def user_contents(request): } -@view_config(route_name='get-content-json', request_method='GET', renderer='json') +@view_config(route_name='get-content-json', request_method='GET', + renderer='json', http_cache=NO_CACHE) @authenticated_only @storage_management def get_content(request): @@ -239,7 +244,8 @@ def get_content(request): return content -@view_config(route_name='get-resource', request_method='GET') +@view_config(route_name='get-resource', request_method='GET', + http_cache=NO_CACHE) @authenticated_only @storage_management def get_resource(request): @@ -370,7 +376,9 @@ def post_content_single(request, cstruct): return content -@view_config(route_name='post-content', request_method='POST', renderer='json') + +@view_config(route_name='post-content', request_method='POST', + renderer='json', http_cache=NO_CACHE) @authenticated_only @storage_management def post_content(request): @@ -407,7 +415,8 @@ def post_content(request): return contents -@view_config(route_name='post-resource', request_method='POST', renderer='string') +@view_config(route_name='post-resource', request_method='POST', + renderer='string', http_cache=NO_CACHE) @authenticated_only @storage_management def post_resource(request): @@ -482,13 +491,12 @@ def delete_content_single(request, id, user_id=None, raise_error=True): return True - @view_config(route_name='delete-user-content', request_method='DELETE', - renderer='json') + renderer='json', http_cache=NO_CACHE) @view_config(route_name='delete-content', request_method='DELETE', - renderer='json') + renderer='json', http_cache=NO_CACHE) @view_config(route_name='delete-content-multiple', request_method='PUT', - renderer='json') + renderer='json', http_cache=NO_CACHE) @authenticated_only @storage_management def delete_content(request): @@ -515,7 +523,9 @@ def delete_content(request): user_id = request.authenticated_userid delete_content_single(request, id, user_id=user_id) -@view_config(route_name='put-content', request_method='PUT', renderer='json') + +@view_config(route_name='put-content', request_method='PUT', + renderer='json', http_cache=NO_CACHE) @authenticated_only @storage_management def put_content(request): @@ -572,7 +582,8 @@ def put_content(request): return content -@view_config(route_name='search-content', request_method='GET', renderer='json') +@view_config(route_name='search-content', request_method='GET', + renderer='json', http_cache=NO_CACHE) @authenticated_only @storage_management def search_content(request): @@ -661,7 +672,8 @@ def post_to_publishing(request, userid, submitlog, content_ids): return contents, requests.post(url, files=files, headers=headers) -@view_config(route_name='publish', request_method='POST', renderer='json') +@view_config(route_name='publish', request_method='POST', + renderer='json', http_cache=NO_CACHE) @authenticated_only @storage_management def publish(request): @@ -698,7 +710,7 @@ def publish(request): @view_config(route_name='acceptance-info', request_method='GET', - renderer='json') + renderer='json', http_cache=NO_CACHE) @authenticated_only @storage_management def get_acceptance_info(request): @@ -747,7 +759,8 @@ def get_acceptance_info(request): return info -@view_config(route_name='acceptance-info', request_method=('POST', 'PUT')) +@view_config(route_name='acceptance-info', + request_method=('POST', 'PUT'), http_cache=NO_CACHE) @authenticated_only @storage_management def post_acceptance_info(request):