[CMF-checkins] CVS: CMF/CMFCore - WorkflowTool.py:1.28

Sidnei da Silva sidnei@x3ng.com.br
Thu, 25 Jul 2002 14:42:11 -0400


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv1066/CMFCore

Modified Files:
	WorkflowTool.py 
Log Message:
Added getChainForPortalType method. Its used to check if a portal type has a workflow. eg: Folder and Topic.

=== CMF/CMFCore/WorkflowTool.py 1.27 => 1.28 ===
 
         """ Show a management screen for changing type to workflow connections.
         """
-        cbt = self._chains_by_type
         ti = self._listTypeInfo()
         types_info = []
         for t in ti:
@@ -146,10 +145,7 @@
             title = t.Title()
             if title == id:
                 title = None
-            if cbt is not None and cbt.has_key(id):
-                chain = join(cbt[id], ', ')
-            else:
-                chain = '(Default)'
+            chain = self.getChainForPortalType(id)
             types_info.append({'id': id,
                                'title': title,
                                'chain': chain})
@@ -459,6 +455,19 @@
                 ids.append(wf_id)
 
         self._default_chain = tuple(ids)
+
+    security.declarePublic('getChainForPortalType')
+    def getChainForPortalType(self, pt_name):
+
+        """Get the chain for a specific portal type.
+        """
+        cbt = self._chains_by_type
+        if cbt is not None and cbt.has_key(pt_name):
+            chain = join(cbt[pt_name], ', ')
+        else:
+            chain = '(Default)'
+
+        return chain
 
     security.declareProtected( ManagePortal, 'setChainForPortalTypes')
     def setChainForPortalTypes(self, pt_names, chain):