[Checkins] SVN: Products.GenericSetup/trunk/Products/GenericSetup/registry.py Undo a bit of code duplication

Wichert Akkerman wichert at wiggy.net
Fri Dec 28 09:11:09 EST 2007


Log message for revision 82492:
  Undo a bit of code duplication

Changed:
  U   Products.GenericSetup/trunk/Products/GenericSetup/registry.py

-=-
Modified: Products.GenericSetup/trunk/Products/GenericSetup/registry.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/registry.py	2007-12-28 14:01:50 UTC (rev 82491)
+++ Products.GenericSetup/trunk/Products/GenericSetup/registry.py	2007-12-28 14:11:09 UTC (rev 82492)
@@ -120,6 +120,20 @@
 
         self._registered = {}
 
+    security.declarePrivate( 'parseXML' )
+    def parseXML( self, text, encoding=None ):
+
+        """ Parse 'text'.
+        """
+        reader = getattr( text, 'read', None )
+
+        if reader is not None:
+            text = reader()
+
+        parser = self.RegistryParser( encoding )
+        parseString( text, parser )
+
+        return parser._parsed
 InitializeClass( BaseStepRegistry )
 
 class ImportStepRegistry( BaseStepRegistry ):
@@ -131,6 +145,7 @@
     implements(IImportStepRegistry)
 
     security = ClassSecurityInfo()
+    RegistryParser = _ImportStepRegistryParser
 
 
     security.declareProtected( ManagePortal, 'sortSteps' )
@@ -242,21 +257,7 @@
 
         self._registered[ id ] = info
 
-    security.declarePrivate( 'parseXML' )
-    def parseXML( self, text, encoding=None ):
 
-        """ Parse 'text'.
-        """
-        reader = getattr( text, 'read', None )
-
-        if reader is not None:
-            text = reader()
-
-        parser = _ImportStepRegistryParser( encoding )
-        parseString( text, parser )
-
-        return parser._parsed
-
     #
     #   Helper methods
     #
@@ -293,6 +294,7 @@
     implements(IExportStepRegistry)
 
     security = ClassSecurityInfo()
+    RegistryParser = _ExportStepRegistryParser
 
     security.declarePrivate( 'registerStep' )
     def registerStep( self, id, handler, title=None, description=None ):
@@ -334,21 +336,7 @@
 
         self._registered[ id ] = info
 
-    security.declarePrivate( 'parseXML' )
-    def parseXML( self, text, encoding=None ):
 
-        """ Parse 'text'.
-        """
-        reader = getattr( text, 'read', None )
-
-        if reader is not None:
-            text = reader()
-
-        parser = _ExportStepRegistryParser( encoding )
-        parseString( text, parser )
-
-        return parser._parsed
-
     #
     #   Helper methods
     #



More information about the Checkins mailing list