[Erp5-report] r40762 arnaud.fontaine - /erp5/trunk/products/ERP5Type/dynamic/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Nov 26 11:10:28 CET 2010


Author: arnaud.fontaine
Date: Fri Nov 26 11:10:27 2010
New Revision: 40762

URL: http://svn.erp5.org?rev=40762&view=rev
Log:
When setting up an ERP5Site, loading Base Type Portal Type would fail
as there are no Portal Types definitions yet

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

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=40762&r1=40761&r2=40762&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py [utf8] Fri Nov 26 11:10:27 2010
@@ -182,12 +182,19 @@ def generatePortalTypeClass(portal_type_
   # Moreover, some tools, such as 'Activity Tool', don't have any
   # portal type
   if type_class is None:
-    # Try to figure out a coresponding document class from the document side.
-    # This can happen when calling newTempAmount for instance:
-    #  Amount has no corresponding Base Type and will never have one
-    #  But the semantic of newTempXXX requires us to create an
-    #  object using the Amount Document, so we promptly do it:
-    type_class = portal_type_name.replace(' ', '')
+    if portal_type_name in core_portal_type_class_dict:
+      # Only happen when portal_types is empty (e.g. when creating a
+      # new ERP5Site)
+      type_class = core_portal_type_class_dict[portal_type_name]['type_class']
+    else:
+      # Try to figure out a coresponding document class from the
+      # document side.  This can happen when calling newTempAmount for
+      # instance:
+      #  Amount has no corresponding Base Type and will never have one
+      #  But the semantic of newTempXXX requires us to create an
+      #  object using the Amount Document, so we promptly do it:
+      type_class = portal_type_name.replace(' ', '')
+
     mixin_list = []
     interface_list = []
 




More information about the Erp5-report mailing list