[Erp5-report] r39623 jm - in /erp5/trunk/products: ERP5/tests/ ERP5Type/dynamic/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Oct 28 17:45:09 CEST 2010
Author: jm
Date: Thu Oct 28 17:45:03 2010
New Revision: 39623
URL: http://svn.erp5.org?rev=39623&view=rev
Log:
Fix initialization of portal types that are defined outside Types Tool
This fixes TestSolvingPackingList
Modified:
erp5/trunk/products/ERP5/tests/testPackingList.py
erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py
Modified: erp5/trunk/products/ERP5/tests/testPackingList.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testPackingList.py?rev=39623&r1=39622&r2=39623&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testPackingList.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testPackingList.py [utf8] Thu Oct 28 17:45:03 2010
@@ -1797,7 +1797,7 @@ class TestSolvingPackingList(TestPacking
id=solver_id,
tested_property_list=tested_property_list,
automatic_solver=1,
- type_factory_method_id='add%s' % solver_class,
+ type_class=solver_class,
type_group_list=('target_solver',),
)
solver.setCriterion(property='portal_type',
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=39623&r1=39622&r2=39623&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py [utf8] Thu Oct 28 17:45:03 2010
@@ -104,23 +104,21 @@ def generatePortalTypeClass(portal_type_
from Products.ERP5.ERP5Site import getSite
site = getSite()
- types_tool = site.portal_types
- portal_type = None
- mixin_list = []
- interface_list = []
accessor_holder_list = []
- try:
- portal_type = types_tool[portal_type_name]
- except KeyError:
+ # 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)
+ if portal_type 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 is not None:
+ mixin_list = []
+ interface_list = []
+ else:
# type_class has a compatibility getter that should return
# something even if the field is not set (i.e. Base Type object
# was not migrated yet)
More information about the Erp5-report
mailing list