parameters: (self)
docstring: Copy stored session data into this session instance.
docstring_summary: Copy stored session data into this session instance.
docstring_tokens: Copy stored session data into this session instance .
function: def load(self):
          """Copy stored session data into this session instance."""
          data = self._load()
          # data is either None or a tuple (session_data, expiration_time)
          if data is None or data[1] < self.now():
              if self.debug:
                  cherrypy.log('Expired session %r, flushing data.' % self.id,
                               'TOOLS.SESSIONS')
              self._data = {}
          else:
              if self.debug:
                  cherrypy.log('Data loaded for session %r.' % self.id,
                               'TOOLS.SESSIONS')
              self._data = data[0]
          self.loaded = True
  
          # Stick the clean_thread in the class, not the instance.
          # The instances are created and destroyed per-request.
          cls = self.__class__
          if self.clean_freq and not cls.clean_thread:
              # clean_up is an instancemethod and not a classmethod,
              # so that tool config can be accessed inside the method.
              t = cherrypy.process.plugins.Monitor(
                  cherrypy.engine, self.clean_up, self.clean_freq * 60,
                  name='Session cleanup')
              t.subscribe()
              cls.clean_thread = t
              t.start()
              if self.debug:
                  cherrypy.log('Started cleanup thread.', 'TOOLS.SESSIONS')
function_tokens: def load ( self ) : data = self . _load ( ) # data is either None or a tuple (session_data, expiration_time) if data is None or data [ 1 ] < self . now ( ) : if self . debug : cherrypy . log ( 'Expired session %r, flushing data.' % self . id , 'TOOLS.SESSIONS' ) self . _data = { } else : if self . debug : cherrypy . log ( 'Data loaded for session %r.' % self . id , 'TOOLS.SESSIONS' ) self . _data = data [ 0 ] self . loaded = True # Stick the clean_thread in the class, not the instance. # The instances are created and destroyed per-request. cls = self . __class__ if self . clean_freq and not cls . clean_thread : # clean_up is an instancemethod and not a classmethod, # so that tool config can be accessed inside the method. t = cherrypy . process . plugins . Monitor ( cherrypy . engine , self . clean_up , self . clean_freq * 60 , name = 'Session cleanup' ) t . subscribe ( ) cls . clean_thread = t t . start ( ) if self . debug : cherrypy . log ( 'Started cleanup thread.' , 'TOOLS.SESSIONS' )