Exemplo n.º 1
0
 def _set_session(self):
     sval_str = json.dumps(self.session_value)
     updated_query = SessionDB.update(expiry_time=self.expiry_time, sval=sval_str).where(
         SessionDB.session_id == self.session_id
     )
     updated = updated_query.execute()
     if not updated:
         if not self.session_id:
             self.session_id = str(uuid.uuid4())
         SessionDB.create(session_id=self.session_id, sval=sval_str, expiry_time=self.expiry_time)
Exemplo n.º 2
0
 def _get_session_from_db(self):
     try:
         rs = SessionDB.get(SessionDB.session_id == self.session_id)
         return rs
     except SessionDB.DoesNotExist:
         return None