示例#1
0
 def create_listing_item(self, brain):
     obj = brain.getObject()
     if not IProduct.providedBy(obj):
         return None
     item = dict()
     item["obj"] = obj
     item["preview"] = img_tag(obj, self.image_scale, "product_listing_image")
     item["buyable_controls"] = True
     if IProductGroup.providedBy(obj):
         item["buyable_controls"] = False
     return item
 def product_group(self):
     uid = self.request.get('uid')
     if not uid:
         raise ValueError(u'No execution context UID')
     obj = get_object_by_uid(self.context, uid)
     if not obj:
         raise ValueError(u'Execution context object not found by UID')
     if IProductGroup.providedBy(obj):
         return obj
     if IVariant.providedBy(obj):
         return aq_parent(obj)
     raise ValueError(u'Object not implements IProductGroup or IVariant')
 def create_listing_item(self, brain):
     obj = brain.getObject()
     if not IProduct.providedBy(obj):
         return None
     item = dict()
     item['obj'] = obj
     item['preview'] = img_tag(
         obj, self.image_scale, 'product_listing_image')
     item['buyable_controls'] = True
     if IProductGroup.providedBy(obj):
         item['buyable_controls'] = False
     return item
示例#4
0
 def product_group(self):
     uid = self.request.get('uid')
     if not uid:
         raise ValueError(u'No execution context UID')
     obj = get_object_by_uid(self.context, uid)
     if not obj:
         raise ValueError(u'Execution context object not found by UID')
     if IProductGroup.providedBy(obj):
         return obj
     if IVariant.providedBy(obj):
         return aq_parent(obj)
     raise ValueError(u'Object not implements IProductGroup or IVariant')