[Erp5-report] r42960 nicolas.dumazet - /erp5/trunk/products/ERP5Type/dynamic/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Feb 3 07:23:08 CET 2011
Author: nicolas.dumazet
Date: Thu Feb 3 07:23:08 2011
New Revision: 42960
URL: http://svn.erp5.org?rev=42960&view=rev
Log:
we need to try harder to find property sheets when the portal type definition does not exist.
This should fix the _baseGetMembershipCriterionCategoryList errors in trunk,
that are here because no portal types exist for some Simulation Rules:
even without portal types, we can find correctly the document class, and
perform better.
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=42960&r1=42959&r2=42960&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/dynamic/portal_type_class.py [utf8] Thu Feb 3 07:23:08 2011
@@ -40,7 +40,6 @@ from Products.ERP5Type.Globals import In
from Products.ERP5Type.Utils import setDefaultClassProperties
from Products.ERP5Type import document_class_registry, mixin_class_registry
-from zope.interface import classImplements
from zLOG import LOG, ERROR, INFO, WARNING
def _importClass(classpath):
@@ -191,6 +190,10 @@ def generatePortalTypeClass(site, portal
mixin_list = portal_type.getTypeMixinList()
interface_list = portal_type.getTypeInterfaceList()
base_category_list = portal_type.getTypeBaseCategoryList()
+ else:
+ LOG("ERP5Type.dynamic", WARNING,
+ "Cannot find a portal type definition for '%s', trying to guess..."
+ % portal_type_name)
# But if neither factory_init_method_id nor type_class are set on
# the portal type, we have to try to guess, for compatibility.
@@ -246,43 +249,42 @@ def generatePortalTypeClass(site, portal
LOG("ERP5Type.dynamic", WARNING,
"Property Sheet Tool was not found. Please update erp5_core "
"Business Template")
+ zodb_property_sheet_set = set()
else:
- if portal_type is not None:
- # Get the Property Sheets defined on the portal_type and use the
- # ZODB Property Sheet rather than the filesystem only if it
- # exists in ZODB
- zodb_property_sheet_set = set(property_sheet_tool.objectIds())
- for property_sheet in portal_type.getTypePropertySheetList():
- if property_sheet in zodb_property_sheet_set:
- property_sheet_set.add(property_sheet)
-
- # XXX maybe this should be a generic hook, adding property sheets
- # dynamically for a given portal type name? If done well, this
- # system could perhaps help erp5_egov to get rid of aq_dynamic
- if portal_type_name in ("Preference Tool",
- "Preference",
- "System Preference"):
- for property_sheet in zodb_property_sheet_set:
- if property_sheet.endswith('Preference'):
- property_sheet_set.add(property_sheet)
- else:
- zodb_property_sheet_set = set()
-
- # Get the Property Sheets defined on the document and its bases
- # recursively. Fallback on the filesystem Property Sheet only and
- # only if the ZODB Property Sheet does not exist
- from Products.ERP5Type.Base import getClassPropertyList
- for property_sheet in getClassPropertyList(klass):
- # If the Property Sheet is a string, then this is a ZODB
- # Property Sheet
- #
- # NOTE: The Property Sheets of a document should be given as a
- # string from now on
- if not isinstance(property_sheet, basestring):
- property_sheet = property_sheet.__name__
+ zodb_property_sheet_set = set(property_sheet_tool.objectIds())
+ if portal_type is not None:
+ # Get the Property Sheets defined on the portal_type and use the
+ # ZODB Property Sheet rather than the filesystem only if it
+ # exists in ZODB
+ for property_sheet in portal_type.getTypePropertySheetList():
if property_sheet in zodb_property_sheet_set:
property_sheet_set.add(property_sheet)
+ # XXX maybe this should be a generic hook, adding property sheets
+ # dynamically for a given portal type name? If done well, this
+ # system could perhaps help erp5_egov to get rid of aq_dynamic
+ if portal_type_name in ("Preference Tool",
+ "Preference",
+ "System Preference"):
+ for property_sheet in zodb_property_sheet_set:
+ if property_sheet.endswith('Preference'):
+ property_sheet_set.add(property_sheet)
+
+ # Get the Property Sheets defined on the document and its bases
+ # recursively. Fallback on the filesystem Property Sheet only and
+ # only if the ZODB Property Sheet does not exist
+ from Products.ERP5Type.Base import getClassPropertyList
+ for property_sheet in getClassPropertyList(klass):
+ # If the Property Sheet is a string, then this is a ZODB
+ # Property Sheet
+ #
+ # NOTE: The Property Sheets of a document should be given as a
+ # string from now on
+ if not isinstance(property_sheet, basestring):
+ property_sheet = property_sheet.__name__
+ if property_sheet in zodb_property_sheet_set:
+ property_sheet_set.add(property_sheet)
+
import erp5
if property_sheet_set:
More information about the Erp5-report
mailing list