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

lazy_class: Universal class initializer for ERP5Workflow.

parent 6d25df3a
...@@ -267,11 +267,16 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder): ...@@ -267,11 +267,16 @@ 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
try:
pt = portal_type._getOb(cls.__name__)
#raise NotImplemented (pt)
if hasattr(pt, 'workflow_list'):
#if cls.__name__ == "Object Type": # Has to be redifined
portal_workflow5 = site.getDefaultModule(portal_type="Workflow") portal_workflow5 = site.getDefaultModule(portal_type="Workflow")
#raise NotImplementedError (portal_workflow5) #<Workflow Module at workflow_module> #raise NotImplementedError (portal_workflow5) #<Workflow Module at workflow_module>
#raise NotImplementedError (cls.__module__) #<class 'erp5.portal_type.Category Property'> #raise NotImplementedError (cls.__module__) #<class 'erp5.portal_type.Category Property'>
...@@ -281,8 +286,8 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder): ...@@ -281,8 +286,8 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder):
% cls.__name__) % cls.__name__)
else: else:
intializePortalTypeERP5WorkflowMethod(cls, portal_workflow5) 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