[Erp5-report] r42819 nicolas.dumazet - /erp5/trunk/products/ERP5Type/dynamic/

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jan 31 14:39:55 CET 2011


Author: nicolas.dumazet
Date: Mon Jan 31 14:39:55 2011
New Revision: 42819

URL: http://svn.erp5.org?rev=42819&view=rev
Log:
return the list of base categories defined on the portal type and set them
on cls._categories

Modified:
    erp5/trunk/products/ERP5Type/dynamic/lazy_class.py
    erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py

Modified: erp5/trunk/products/ERP5Type/dynamic/lazy_class.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/dynamic/lazy_class.py?rev=42819&r1=42818&r2=42819&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dynamic/lazy_class.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/dynamic/lazy_class.py [utf8] Mon Jan 31 14:39:55 2011
@@ -225,16 +225,20 @@ class PortalTypeMetaClass(GhostBaseMetaC
         base_tuple = (ERP5BaseBroken, )
         attribute_dict = {}
         interface_list = []
+        base_category_list = []
       else:
-        base_tuple, interface_list, attribute_dict = class_definition
+        base_tuple, interface_list, base_category_list, attribute_dict = class_definition
 
       klass.__isghost__ = False
       klass.__bases__ = base_tuple
 
+      klass.resetAcquisitionAndSecurity()
+
       for key, value in attribute_dict.iteritems():
         setattr(klass, key, value)
 
-      klass.resetAcquisitionAndSecurity()
+      klass._categories = base_category_list
+
       for interface in interface_list:
         classImplements(klass, interface)
     finally:

Modified: erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py?rev=42819&r1=42818&r2=42819&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py [utf8] Mon Jan 31 14:39:55 2011
@@ -135,6 +135,13 @@ def generatePortalTypeClass(site, portal
   Base Type object holding the definition of this portal type,
   and computes __bases__ and __dict__ for the class that will
   be created to represent this portal type
+
+  Returns tuple with 4 items:
+    - base_tuple: a tuple of classes to be used as __bases__
+    - interface_list: list of zope interfaces the portal type implements
+    - base_category_list: base categories defined on the portal_type itself
+       (a.k.a. excluding categories from Property sheets and documents)
+    - attribute dictionary: any additional attributes to put on the class
   """
   # LOG("ERP5Type.dynamic", INFO, "Loading portal type " + portal_type_name)
 
@@ -155,13 +162,14 @@ def generatePortalTypeClass(site, portal
 
       # Don't do anything else, just allow to load fully the outer
       # portal type class
-      return ((klass,), [], {})
+      return ((klass,), [], [], {})
 
   # Do not use __getitem__ (or _getOb) because portal_type may exist in a
   # type provider other than Types Tool.
   portal_type = getattr(site.portal_types, portal_type_name, None)
 
   type_class = None
+  base_category_list = []
 
   if portal_type is not None:
     # type_class has a compatibility getter that should return
@@ -178,6 +186,7 @@ def generatePortalTypeClass(site, portal
 
     mixin_list = portal_type.getTypeMixinList()
     interface_list = portal_type.getTypeInterfaceList()
+    base_category_list = portal_type.getTypeBaseCategoryList()
 
   # But if neither factory_init_method_id nor type_class are set on
   # the portal type, we have to try to guess, for compatibility.
@@ -306,6 +315,7 @@ def generatePortalTypeClass(site, portal
 
   return (tuple(base_class_list),
           interface_class_list,
+          base_category_list,
           dict(portal_type=portal_type_name))
 
 from lazy_class import generateLazyPortalTypeClass



More information about the Erp5-report mailing list