Set up the storage system for file-based sessions. This should only be called once per process; this will be done automatically when using sessions.init (as the built-in Tool does).
(cls, **kwargs)
| 501 | |
| 502 | @classmethod |
| 503 | def setup(cls, **kwargs): |
| 504 | """Set up the storage system for file-based sessions. |
| 505 | |
| 506 | This should only be called once per process; this will be done |
| 507 | automatically when using sessions.init (as the built-in Tool |
| 508 | does). |
| 509 | """ |
| 510 | # The 'storage_path' arg is required for file-based sessions. |
| 511 | kwargs['storage_path'] = os.path.abspath(kwargs['storage_path']) |
| 512 | |
| 513 | for k, v in kwargs.items(): |
| 514 | setattr(cls, k, v) |
| 515 | |
| 516 | def _get_file_path(self): |
| 517 | f = os.path.join(self.storage_path, self.SESSION_PREFIX + self.id) |