# Setup other connections / useful objects
##########################################
+ # Setup Session Manager, not needed in celery
+ self.session_manager = session.SessionManager()
+
# load all available locales
setup_locales()
## Attach utilities to the request object
# Do we really want to load this via middleware? Maybe?
- session_manager = session.SessionManager()
+ session_manager = self.session_manager
request.session = session_manager.load_session_from_cookie(request)
# Attach self as request.app
# Also attach a few utilities from request.app for convenience?
response = render_http_exeption(
request, e, e.get_description(environ))
- session_manager.save_session_to_cookie(request.session, response)
+ session_manager.save_session_to_cookie(request.session,
+ request, response)
return response(environ, start_response)
except itsdangerous.BadData:
return Session()
- def save_session_to_cookie(self, session, response):
+ def save_session_to_cookie(self, session, request, response):
if not session.is_updated():
return
elif not session:
- response.delete_cookie(self.cookie_name)
+ response.delete_cookie(self.cookie_name,
+ path=request.environ['SCRIPT_NAME'])
else:
- response.set_cookie(self.cookie_name, self.signer.dumps(session))
+ response.set_cookie(self.cookie_name, self.signer.dumps(session),
+ path=request.environ['SCRIPT_NAME'],
+ httponly=True)