Beispiel #1
0
 def _save(self, expiration_time):
     q = None
     try:
         q = SqlQuery(self._db, 'sessions', SESSION_TABLE, trans=True)
         q.delete({'id': self.id})
         data = pickle.dumps((self._data, expiration_time), self._proto)
         q.insert((self.id, base64.b64encode(data), expiration_time))
         q.commit()
     except Exception:  # pylint: disable=broad-except
         if q:
             q.rollback()
         raise
Beispiel #2
0
 def _cleanup(self):
     # pylint: disable=protected-access
     table = SqlQuery(self._db, 'sessions', SESSION_TABLE)._table
     # pylint: disable=no-value-for-parameter
     d = table.delete().where(table.c.expiration_time <=
                              datetime.datetime.now())
     return d.execute().rowcount
Beispiel #3
0
 def _delete(self):
     q = SqlQuery(self._db, 'sessions', SESSION_TABLE)
     q.delete({'id': self.id})