本文整理汇总了Python中serializer.Serializer.loads方法的典型用法代码示例。如果您正苦于以下问题:Python Serializer.loads方法的具体用法?Python Serializer.loads怎么用?Python Serializer.loads使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类serializer.Serializer
的用法示例。
在下文中一共展示了Serializer.loads方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_product
# 需要导入模块: from serializer import Serializer [as 别名]
# 或者: from serializer.Serializer import loads [as 别名]
def get_product(self, product_id):
"""
Returns the cart details as a Dictionary for the given product_id
"""
if self.user_cart_exists:
product_string = self.redis_connection.hget(
self.user_redis_key, product_id)
if product_string:
return Serializer.loads(product_string)
else:
return {}
else:
raise ErrorMessage("The user cart is Empty")
示例2: get_product_dicts
# 需要导入模块: from serializer import Serializer [as 别名]
# 或者: from serializer.Serializer import loads [as 别名]
def get_product_dicts(self):
"""
Returns the list of all product details
"""
return [Serializer.loads(product_string) for product_string in self.redis_connection.hvals(self.user_redis_key)]
示例3: get
# 需要导入模块: from serializer import Serializer [as 别名]
# 或者: from serializer.Serializer import loads [as 别名]
def get(self):
"""
Returns all the products and their details present in the cart as a dictionary
"""
return {key: Serializer.loads(value) for key, value in self.__get_raw_cart().iteritems()}