Exemplo n.º 1
0
 def find_first_non_category(self):
     """Walk up from the current context and find the first object that
     isn't of type ShopCategory.
     """
     # Start with the ShopItem's parent (which is a ShopCategory)
     parent = aq_parent(self.context)
     while IShopCategory.providedBy(parent):
         parent = aq_parent(parent)
     return parent
Exemplo n.º 2
0
 def find_first_non_category(self):
     """Walk up from the current context and find the first object that
     isn't of type ShopCategory.
     """
     # Start with the ShopItem's parent (which is a ShopCategory)
     parent = aq_parent(self.context)
     while IShopCategory.providedBy(parent):
         parent = aq_parent(parent)
     return parent
Exemplo n.º 3
0
 def before_create(self):
     super(ShopItemBuilder, self).before_create()
     if not IShopCategory.providedBy(self.container):
         self.container = create(Builder('shop category'))