Commit 70453886 authored by Nicolas Dumazet's avatar Nicolas Dumazet

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.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42960 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 71dcab56
...@@ -40,7 +40,6 @@ from Products.ERP5Type.Globals import InitializeClass ...@@ -40,7 +40,6 @@ from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5Type.Utils import setDefaultClassProperties from Products.ERP5Type.Utils import setDefaultClassProperties
from Products.ERP5Type import document_class_registry, mixin_class_registry from Products.ERP5Type import document_class_registry, mixin_class_registry
from zope.interface import classImplements
from zLOG import LOG, ERROR, INFO, WARNING from zLOG import LOG, ERROR, INFO, WARNING
def _importClass(classpath): def _importClass(classpath):
...@@ -191,6 +190,10 @@ def generatePortalTypeClass(site, portal_type_name): ...@@ -191,6 +190,10 @@ def generatePortalTypeClass(site, portal_type_name):
mixin_list = portal_type.getTypeMixinList() mixin_list = portal_type.getTypeMixinList()
interface_list = portal_type.getTypeInterfaceList() interface_list = portal_type.getTypeInterfaceList()
base_category_list = portal_type.getTypeBaseCategoryList() 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 # But if neither factory_init_method_id nor type_class are set on
# the portal type, we have to try to guess, for compatibility. # the portal type, we have to try to guess, for compatibility.
...@@ -246,12 +249,13 @@ def generatePortalTypeClass(site, portal_type_name): ...@@ -246,12 +249,13 @@ def generatePortalTypeClass(site, portal_type_name):
LOG("ERP5Type.dynamic", WARNING, LOG("ERP5Type.dynamic", WARNING,
"Property Sheet Tool was not found. Please update erp5_core " "Property Sheet Tool was not found. Please update erp5_core "
"Business Template") "Business Template")
zodb_property_sheet_set = set()
else: else:
zodb_property_sheet_set = set(property_sheet_tool.objectIds())
if portal_type is not None: if portal_type is not None:
# Get the Property Sheets defined on the portal_type and use the # Get the Property Sheets defined on the portal_type and use the
# ZODB Property Sheet rather than the filesystem only if it # ZODB Property Sheet rather than the filesystem only if it
# exists in ZODB # exists in ZODB
zodb_property_sheet_set = set(property_sheet_tool.objectIds())
for property_sheet in portal_type.getTypePropertySheetList(): for property_sheet in portal_type.getTypePropertySheetList():
if property_sheet in zodb_property_sheet_set: if property_sheet in zodb_property_sheet_set:
property_sheet_set.add(property_sheet) property_sheet_set.add(property_sheet)
...@@ -265,8 +269,6 @@ def generatePortalTypeClass(site, portal_type_name): ...@@ -265,8 +269,6 @@ def generatePortalTypeClass(site, portal_type_name):
for property_sheet in zodb_property_sheet_set: for property_sheet in zodb_property_sheet_set:
if property_sheet.endswith('Preference'): if property_sheet.endswith('Preference'):
property_sheet_set.add(property_sheet) property_sheet_set.add(property_sheet)
else:
zodb_property_sheet_set = set()
# Get the Property Sheets defined on the document and its bases # Get the Property Sheets defined on the document and its bases
# recursively. Fallback on the filesystem Property Sheet only and # recursively. Fallback on the filesystem Property Sheet only and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment