def load(cls, id, hmac, assoc_tag=None): try: cart_data = redis.get("%s:%s" % (id, hmac)) if cart_data: return pickle.loads(cart_data) except: app.logger.error('Failed loading cart from cache') c = cls(id, hmac, assoc_tag) c.modified = True # force persist return c
def load(cls, id, hmac, assoc_tag=None): cart_data = redis.get("%s:%s" % (id, hmac)) if cart_data: try: return pickle.loads(cart_data) except: pass c = cls(id, hmac, assoc_tag) c.modified = True # force persist return c
def session_info(self): if self.session_info_serialized: return pickle.loads(str(self.session_info_serialized)) else: return None
def data(self): return pickle.loads(str(self.data_serialized))
def loads(buf): try: buf = zlib.decompress(buf) except: pass return pickle.loads(buf)
def __getitem__(self, url): record = self.db.webpage.find_one({'_id': url}) if record: return pickle.loads(zlib.decompress(record['result'])) else: raise KeyError(url + 'does not exist')