Get session ID from cookie, load corresponding session data from coupled store and inject session data into the request context.
(self, request, response)
| 79 | return str(uuid.uuid4()) |
| 80 | |
| 81 | def process_request(self, request, response): |
| 82 | """Get session ID from cookie, load corresponding session data from coupled store and inject session data into |
| 83 | the request context. |
| 84 | """ |
| 85 | sid = request.cookies.get(self.cookie_name, None) |
| 86 | data = {} |
| 87 | if sid is not None: |
| 88 | if self.store.exists(sid): |
| 89 | data = self.store.get(sid) |
| 90 | request.context.update({self.context_name: data}) |
| 91 | |
| 92 | def process_response(self, request, response, resource, req_succeeded): |
| 93 | """Save request context in coupled store object. Set cookie containing a session ID.""" |