Commit ffff687e authored by wenjie.zheng's avatar wenjie.zheng

lazy_class.py: avoid site creation crash.

parent ee4f6e30
...@@ -289,18 +289,12 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder): ...@@ -289,18 +289,12 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder):
portal_types = site.getDefaultModule(portal_type="portal_types") portal_types = site.getDefaultModule(portal_type="portal_types")
object_ptype = portal_types._getOb(cls.__name__, None) object_ptype = portal_types._getOb(cls.__name__, None)
if object_ptype is not None: if object_ptype is not None:
workflow_list = getattr(object_ptype, 'erp5workflow_list', None) workflow_list = getattr(object_ptype, 'erp5workflow_list', [])
try: if workflow_list is not []:
if workflow_list is not None: ERP5Workflow = getattr(site, "workflow_module", None)
portal_ERP5Workflow = site.getDefaultModule(portal_type="Workflow") if ERP5Workflow is not None:
if portal_ERP5Workflow is None: intializePortalTypeERP5WorkflowMethod(cls, ERP5Workflow)
LOG("ERP5Type.Dynamic", WARNING,
"no ERP5Workflow methods for %s"
% cls.__name__)
else:
intializePortalTypeERP5WorkflowMethod(cls, portal_ERP5Workflow)
except:
pass
# portal type group methods, isNodeType, isResourceType... # portal type group methods, isNodeType, isResourceType...
from Products.ERP5Type.ERP5Type import ERP5TypeInformation from Products.ERP5Type.ERP5Type import ERP5TypeInformation
# XXX possible optimization: # XXX possible optimization:
......
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