Commit 2f6a15cb authored by wenjie.zheng's avatar wenjie.zheng

lazy_class: Universal class initializer for ERP5Workflow.

parent 6d25df3a
...@@ -267,22 +267,27 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder): ...@@ -267,22 +267,27 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder):
initializePortalTypeDynamicWorkflowMethods(cls, portal_workflow) initializePortalTypeDynamicWorkflowMethods(cls, portal_workflow)
# ================== Workflow5 Project, Wenjie, Dec 2014 ======================= # ================== Workflow5 Project, Wenjie, Dec 2014 =======================
#raise NotImplementedError (cls.__name__) # Category Property
### the ERP5Workflow list is defined in ERP5Type, only try to get erp5workflow ### the ERP5Workflow list is defined in ERP5Type, only try to get erp5workflow
### when it's an erp5workflow related type. ### when it's an erp5workflow related type.
portal_type = site.getDefaultModule(portal_type="portal_types")
if cls.__name__ == "Object Type": ### try to get workflow_list from related types then initialize the class of types
portal_workflow5 = site.getDefaultModule(portal_type="Workflow") try:
#raise NotImplementedError (portal_workflow5) #<Workflow Module at workflow_module> pt = portal_type._getOb(cls.__name__)
#raise NotImplementedError (cls.__module__) #<class 'erp5.portal_type.Category Property'> #raise NotImplemented (pt)
if portal_workflow5 is None: if hasattr(pt, 'workflow_list'):
LOG("ERP5Type.Dynamic", WARNING, #if cls.__name__ == "Object Type": # Has to be redifined
"no workflow5 methods for %s" portal_workflow5 = site.getDefaultModule(portal_type="Workflow")
% cls.__name__) #raise NotImplementedError (portal_workflow5) #<Workflow Module at workflow_module>
else: #raise NotImplementedError (cls.__module__) #<class 'erp5.portal_type.Category Property'>
intializePortalTypeERP5WorkflowMethod(cls, portal_workflow5) if portal_workflow5 is None:
LOG("ERP5Type.Dynamic", WARNING,
"no workflow5 methods for %s"
% cls.__name__)
else:
intializePortalTypeERP5WorkflowMethod(cls, portal_workflow5)
except:
pass
# ================== WF5 ======================================================= # ================== WF5 =======================================================
# portal type group methods, isNodeType, isResourceType... # portal type group methods, isNodeType, isResourceType...
......
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