[CMF-checkins] CVS: CMF/CMFSetup - interfaces.py:1.6 tool.py:1.5

Tres Seaver tseaver at zope.com
Sun May 23 17:59:46 EDT 2004


Update of /cvs-repository/CMF/CMFSetup
In directory cvs.zope.org:/tmp/cvs-serv430

Modified Files:
	interfaces.py tool.py 
Log Message:


  - interfaces.py:

    o Modify return value from 'runImportStep' and 'runAllImportSteps' to
      be a mapping, with keys 'steps' and 'messages' to allow examining
      status of the run.

  - tool.py:

    o Implement change to return value of 'runImportStep'.

    o Implement and test 'runAllImportSteps'.


=== CMF/CMFSetup/interfaces.py 1.5 => 1.6 ===
--- CMF/CMFSetup/interfaces.py:1.5	Sun May 23 17:05:08 2004
+++ CMF/CMFSetup/interfaces.py	Sun May 23 17:59:15 2004
@@ -301,6 +301,13 @@
 
         o If 'run_dependencies' is True, then run any out-of-date
           dependency steps first.
+
+        o Return a mapping, with keys:
+
+          'steps' -- a sequence of IDs of the steps run.
+
+          'messages' -- a dictionary holding messages returned from each
+            step
         """
 
     def runAllImportSteps( purge_old=True ):
@@ -310,6 +317,13 @@
         o If 'purge_old' is True, then run each step after purging any
           "old" setup first (this is the responsibility of the step,
           which must check the context we supply).
+
+        o Return a mapping, with keys:
+
+          'steps' -- a sequence of IDs of the steps run.
+
+          'messages' -- a dictionary holding messages returned from each
+            step
         """
 
     def runExportStep( step_id ):


=== CMF/CMFSetup/tool.py 1.4 => 1.5 ===
--- CMF/CMFSetup/tool.py:1.4	Sun May 23 17:32:27 2004
+++ CMF/CMFSetup/tool.py	Sun May 23 17:59:15 2004
@@ -121,21 +121,38 @@
 
         dependencies = info.get( 'dependencies', () )
 
+        messages = {}
+        steps = []
         if run_dependencies:
-            already = {}
             for dependency in dependencies:
 
-                if already.get( dependency ) is None:
-                    self._doRunImportStep( dependency, context )
-                    already[ dependency ] = 1
+                if dependency not in steps:
+                    message = self._doRunImportStep( dependency, context )
+                    messages[ dependency ] = message
+                    steps.append( dependency )
+
+        message = self._doRunImportStep( step_id, context )
+        messages[ step_id ] = message
+        steps.append( step_id )
 
-        return self._doRunImportStep( step_id, context )
+        return { 'steps' : steps, 'messages' : messages }
 
     security.declareProtected( ManagePortal, 'runAllSetupSteps')
     def runAllImportSteps( self, purge_old=True ):
 
         """ See ISetupTool.
         """
+        profile_path = self._getFullyQualifiedProfileDirectory()
+        context = ImportContext( self, profile_path, purge_old )
+
+        steps = self._import_registry.sortSteps()
+        messages = {}
+
+        for step in steps:
+            message = self._doRunImportStep( step, context )
+            messages[ step ] = message
+
+        return { 'steps' : steps, 'messages' : messages }
 
     security.declareProtected( ManagePortal, 'runExportStep')
     def runExportStep( self, step_id ):
@@ -217,6 +234,9 @@
         """ Run a single import step, using a pre-built context.
         """
         handler = self._import_registry.getStep( step_id )
+
+        if handler is None:
+            raise ValueError( 'Invalid import step: %s' % step_id )
 
         return handler( context )
 




More information about the CMF-checkins mailing list