No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.py 986B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # -*- coding: utf-8 -*-
  2. """
  3. from lodel.auth.exceptions import AuthenticationError
  4. from lodel.plugin import LodelHook
  5. from .filesystem_session_store import FileSystemSession
  6. ## @brief starts a new session and returns its sid
  7. # @param caller *
  8. # @param payload dict
  9. # @return str
  10. @LodelHook('session_start')
  11. def start_session(caller, payload):
  12. new_session = FileSystemSession(content=payload)
  13. return new_session.sid
  14. '''
  15. ## @brief destroys a session
  16. # @param caller *
  17. # @param sid str : session id
  18. @LodelHook('session_destroy')
  19. def stop_session(caller, sid):
  20. FileSystemSession.destroy(sid)
  21. '''
  22. ## @brief reads a session content
  23. # @param caller *
  24. # @param sid str: session id
  25. # @return FileSystemSession
  26. @LodelHook('session_load')
  27. def read_session(caller, sid):
  28. return FileSystemSession.load(sid)
  29. '''
  30. ## @brief destroys all the old sessions (expired ones)
  31. # @param caller *
  32. @LodelHook('session_clean')
  33. def clean_sessions(caller):
  34. FileSystemSession.clean()
  35. '''
  36. """