Example #1
0
 def exists(self, session_key):
     """
     Check if session exists.
     """
     return bool(
         hsdb.get(TABLE_NAME, ('session_key', ),
                  session_key,
                  shard_seed=make_seed(session_key)))
Example #2
0
 def load(self):
     row = hsdb.get(TABLE_NAME, ('session_key', 'session_data', 'expire_date'), self.session_key,
         shard_seed=make_seed(self.session_key))
     if row and datetime.now() <= datetime.strptime(row['expire_date'], '%Y-%m-%d %H:%M:%S'):
         return self.decode(force_unicode(row['session_data']))
     else:
         self.create()
         return {}
Example #3
0
 def load(self):
     row = hsdb.get(TABLE_NAME,
                    ('session_key', 'session_data', 'expire_date'),
                    self.session_key,
                    shard_seed=make_seed(self.session_key))
     if row and datetime.now() <= datetime.strptime(row['expire_date'],
                                                    '%Y-%m-%d %H:%M:%S'):
         return self.decode(force_unicode(row['session_data']))
     else:
         self.create()
         return {}
Example #4
0
 def exists(self, session_key):
     """
     Check if session exists.
     """
     return bool(hsdb.get(TABLE_NAME, ('session_key', ), session_key, shard_seed=make_seed(session_key)))