def save(self, session): obj = self.get_session(session.sid) or Session(sid=session.sid) try: obj.set_data(dict(session)) obj.save() db.commit() except pickle.PickleError: pass
def list(self): return Session.select('sid').fetch(-1)
def get_session(self, sid): obj = Session.all().filter('sid ==', sid).fetch(1) return obj[0] if obj else None