MCPcopy
hub / github.com/django/django / _key_to_file

Method _key_to_file

django/contrib/sessions/backends/file.py:47–60  ·  view source on GitHub ↗

Get the file associated with this session key.

(self, session_key=None)

Source from the content-addressed store, hash-verified

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 """

Callers 9

_last_modificationMethod · 0.95
loadMethod · 0.95
saveMethod · 0.95
existsMethod · 0.95
deleteMethod · 0.95

Calls 3

InvalidSessionKeyClass · 0.90
joinMethod · 0.45