MCPcopy Index your code
hub / github.com/pyload/pyload / save

Method save

module/lib/beaker/session.py:257–292  ·  view source on GitHub ↗

Saves the data for this session to persistent storage If accessed_only is True, then only the original data loaded at the beginning of the request will be saved, with the updated last accessed time.

(self, accessed_only=False)

Source from the content-addressed store, hash-verified

255 self.invalidate()
256
257 def save(self, accessed_only=False):
258 """Saves the data for this session to persistent storage
259
260 If accessed_only is True, then only the original data loaded
261 at the beginning of the request will be saved, with the updated
262 last accessed time.
263
264 """
265 # Look to see if its a new session that was only accessed
266 # Don't save it under that case
267 if accessed_only and self.is_new:
268 return None
269
270 if not hasattr(self, 'namespace'):
271 self.namespace = self.namespace_class(
272 self.id,
273 data_dir=self.data_dir,
274 digest_filenames=False,
275 **self.namespace_args)
276
277 self.namespace.acquire_write_lock()
278 try:
279 if accessed_only:
280 data = dict(self.accessed_dict.items())
281 else:
282 data = dict(self.items())
283
284 # Save the data
285 if not data and 'session' in self.namespace:
286 del self.namespace['session']
287 else:
288 self.namespace['session'] = data
289 finally:
290 self.namespace.release_write_lock()
291 if self.is_new:
292 self.request['set_cookie'] = True
293
294 def revert(self):
295 """Revert the session to its original state from its first

Callers 1

persistMethod · 0.45

Calls 4

dictFunction · 0.85
itemsMethod · 0.80
acquire_write_lockMethod · 0.45
release_write_lockMethod · 0.45

Tested by

no test coverage detected