[Erp5-report] r31628 leonardo - /erp5/trunk/products/ERP5Type/Workflow.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jan 7 14:34:54 CET 2010


Author: leonardo
Date: Thu Jan  7 14:34:53 2010
New Revision: 31628

URL: http://svn.erp5.org?rev=31628&view=rev
Log:
Register workflows the CMF2 way even under CFM1 so tests only need to use the CMF2 way of creating workflows

Modified:
    erp5/trunk/products/ERP5Type/Workflow.py

Modified: erp5/trunk/products/ERP5Type/Workflow.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Workflow.py?rev=31628&r1=31627&r2=31628&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Workflow.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Workflow.py [utf8] Thu Jan  7 14:34:53 2010
@@ -38,34 +38,33 @@
 _workflow_factories = {}
 
 try:
-  from Products.CMFCore.WorkflowTool import addWorkflowFactory
+  from Products.CMFCore.WorkflowTool import addWorkflowFactory as baseAddWorkflowFactory
   # We're on CMF 1.5
 except ImportError:
   # We're on CMF 2
-  zLOG.LOG('Products.ERP5Type.Workflow.addWorkflowFactory',
-           zLOG.INFO,
-           summary='Registering Workflow Factories Directly',
-           detail='Products.CMFCore.WorkflowTool.addWorkflowFactory has '
-           'been removed from CMFCore. Workflows will be registered as '
-           'Zope 2 style factories instead.')
-  def addWorkflowFactory(factory, id, title):
-      """addWorkflowFactory replacement
-      
-      addWorkflowFactory has been removed from CMFCore 2.x.
-      DCWorkflow, which now handles this job, consults the GenericSetup tool,
-      at runtime, to determine all valid workflows.
-      
-      Instead of providing xml files in GenericSetup profiles for our,
-      workflows we prepare our own Zope2 style factories for registration
-      in the Workflow Tool.
-      """
-      assert not _workflow_factories.get(id), (
-          'Workflow with id %r already exists.' % id)
-
-      factory_info = dict(factory=factory,
-                          id=id,
-                          title=title)
-      _workflow_factories[id] = factory_info
+  def baseAddWorkflowFactory(factory, id, tittle):
+    pass
+
+def addWorkflowFactory(factory, id, title):
+    """addWorkflowFactory replacement
+    
+    addWorkflowFactory has been removed from CMFCore 2.x.
+    DCWorkflow, which now handles this job, consults the GenericSetup tool,
+    at runtime, to determine all valid workflows.
+    
+    Instead of providing xml files in GenericSetup profiles for our,
+    workflows we prepare our own Zope2 style factories for registration
+    in the Workflow Tool.
+    """
+    assert not _workflow_factories.get(id), (
+        'Workflow with id %r already exists.' % id)
+
+    factory_info = dict(factory=factory,
+                        id=id,
+                        title=title)
+    _workflow_factories[id] = factory_info
+    # register with CMF 1 if it's still there
+    baseAddWorkflowFactory(factory, id, title)
 
 # Workflow Creation DTML
 manage_addWorkflowFormDtml = HTMLFile('dtml/addWorkflow', globals())




More information about the Erp5-report mailing list