[Zope3-checkins] CVS: Packages3/workflow - globalimportexport.py:1.3

Michael Howitz mh+zope@gocept.com
Thu, 27 Mar 2003 08:30:14 -0500


Update of /cvs-repository/Packages3/workflow
In directory cvs.zope.org:/tmp/cvs-serv11443

Modified Files:
	globalimportexport.py 
Log Message:
switched from TypeRegistry to ImplementorRegistry to get also subclasses/-interfaces registered


=== Packages3/workflow/globalimportexport.py 1.2 => 1.3 ===
--- Packages3/workflow/globalimportexport.py:1.2	Thu Mar 27 05:55:58 2003
+++ Packages3/workflow/globalimportexport.py	Thu Mar 27 08:30:14 2003
@@ -17,7 +17,7 @@
 """
 __metaclass__ = type
 
-from zope.interface.type import TypeRegistry
+from zope.interface.implementor import ImplementorRegistry
 from zope.interface._flatten import _flatten
 from zope.proxy.introspection import removeAllProxies
 from zope.app.interfaces.workflow import IProcessDefinition
@@ -29,21 +29,23 @@
 
 
     def __init__(self):
-        self._importers = TypeRegistry()
-        self._exporters = TypeRegistry()
+        self._importers = ImplementorRegistry()
+        self._exporters = ImplementorRegistry()
         
     _clear = __init__
 
     # IProcessDefinitionImportExport
     
-    def importProcessDefinition(self, data):
+    def importProcessDefinition(self, context, data):
         """Import a Process Definition
         """
-        for factory in self._importers.values():
-            if factory is not None:
-                imp = factory()
-                if imp.canHandle(data):
-                    return imp.doImport(data)
+        import pdb
+        pdb.set_trace()
+        factory = self._importers.get(IProcessDefinition)
+        if factory is not None:
+            imp = factory()
+            if imp.canImport(data):
+                return imp.doImport(context, data)
         raise ValueError, 'No Importer can handle that information'
 
     def exportProcessDefinition(self, context, process_definition):
@@ -64,12 +66,12 @@
     def addImportHandler(self, interface, factory):
         """add Import Handler for ProcessDefinition
         """
-        self._importers.setdefault(interface, factory)
+        self._importers.register(interface, factory)
 
     def addExportHandler(self, interface, factory):
         """add Export Handler for ProcessDefinition
         """
-        self._exporters.setdefault(interface, factory)
+        self._exporters.register(interface, factory)