[Erp5-report] r38646 nicolas.dumazet - /erp5/trunk/products/ERP5Type/ERP5Type.py

nobody at svn.erp5.org nobody at svn.erp5.org
Sun Sep 26 11:09:03 CEST 2010


Author: nicolas.dumazet
Date: Sun Sep 26 11:09:02 2010
New Revision: 38646

URL: http://svn.erp5.org?rev=38646&view=rev
Log:
compatibility getter for portal types as classes:
factory_method_id will disappear, and type_class will
be used instead

Modified:
    erp5/trunk/products/ERP5Type/ERP5Type.py

Modified: erp5/trunk/products/ERP5Type/ERP5Type.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/ERP5Type.py?rev=38646&r1=38645&r2=38646&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/ERP5Type.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/ERP5Type.py [utf8] Sun Sep 26 11:09:02 2010
@@ -415,6 +415,21 @@ class ERP5TypeInformation(XMLObject,
       return list(self.property_sheet_list)
 
     security.declareProtected(Permissions.AccessContentsInformation,
+                              'getTypeClass')
+    def getTypeClass(self):
+      """Getter for type_class"""
+      base = self._baseGetTypeClass()
+      if base is None:
+        # backwards compatibility: if the object has no
+        # new-style type class, use the oldstyle factory attribute
+        init_script = self.getTypeFactoryMethodId()
+        if init_script and init_script.startswith('add'):
+          base = init_script[3:]
+          # and of course migrate the property
+          self.setTypeClass(base)
+      return base
+
+    security.declareProtected(Permissions.AccessContentsInformation,
                               'getTypeBaseCategoryList')
     def getTypeBaseCategoryList(self):
       """Getter for 'type_base_category' property"""




More information about the Erp5-report mailing list