Get the file associated with this session key.
(self, session_key=None)
| 45 | return storage_path |
| 46 | |
| 47 | def _key_to_file(self, session_key=None): |
| 48 | """ |
| 49 | Get the file associated with this session key. |
| 50 | """ |
| 51 | if session_key is None: |
| 52 | session_key = self._get_or_create_session_key() |
| 53 | |
| 54 | # Make sure we're not vulnerable to directory traversal. Session keys |
| 55 | # should always be md5s, so they should never contain directory |
| 56 | # components. |
| 57 | if not set(session_key).issubset(VALID_KEY_CHARS): |
| 58 | raise InvalidSessionKey("Invalid characters in session key") |
| 59 | |
| 60 | return os.path.join(self.storage_path, self.file_prefix + session_key) |
| 61 | |
| 62 | def _last_modification(self): |
| 63 | """ |