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):
        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
Beispiel #4
0
 def session_info(self):
     if self.session_info_serialized:
         return pickle.loads(str(self.session_info_serialized))
     else:
         return None
Beispiel #5
0
 def data(self):
     return pickle.loads(str(self.data_serialized))
Beispiel #6
0
 def loads(buf):
     try:
         buf = zlib.decompress(buf)
     except:
         pass
     return pickle.loads(buf)
Beispiel #7
0
 def loads(buf):
     try:
         buf = zlib.decompress(buf)
     except:
         pass
     return pickle.loads(buf)
Beispiel #8
0
 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')