[Checkins] SVN: Products.GenericSetup/branches/wichert-dependencies/tool.py Merge the results for all imported profiles

Wichert Akkerman wichert at wiggy.net
Fri Nov 23 13:17:06 EST 2007


Log message for revision 81969:
  Merge the results for all imported profiles

Changed:
  U   Products.GenericSetup/branches/wichert-dependencies/tool.py

-=-
Modified: Products.GenericSetup/branches/wichert-dependencies/tool.py
===================================================================
--- Products.GenericSetup/branches/wichert-dependencies/tool.py	2007-11-23 18:15:52 UTC (rev 81968)
+++ Products.GenericSetup/branches/wichert-dependencies/tool.py	2007-11-23 18:17:05 UTC (rev 81969)
@@ -1105,22 +1105,26 @@
                                    archive=None,
                                    ignore_dependencies=False,
                                    seen=None):
-        if seen is None:
-            seen=set()
-        seen.add( profile_id )
 
+        results = []
+
         if not ignore_dependencies:
+            if seen is None:
+                seen=set()
+            seen.add( profile_id )
+
             dependencies = self.getDependenciesForProfile( profile_id )
             for dependency in dependencies:
                 if dependency not in seen:
                     if not self.profileExists( dependency ):
                         warn("Profile %s depends on unknown profile %s" % (profile_id, dependency))
                         continue
-                    self._runImportStepsFromContext(steps=steps,
+                    res = self._runImportStepsFromContext(steps=steps,
                                                     purge_old=purge_old,
                                                     profile_id=dependency,
                                                     ignore_dependencies=ignore_dependencies,
                                                     seen=seen)
+                    results.append( res )
 
         context = self._getImportContext(profile_id, purge_old, archive)
         self.applyContext(context)
@@ -1140,8 +1144,23 @@
 
         event.notify(ProfileImportedEvent(self, profile_id, steps, True))
 
-        return { 'steps' : steps, 'messages' : messages }
+        results.append({'steps' : steps, 'messages' : messages })
 
+        data = { 'steps' : [], 'messages' : {}}
+        for result in results:
+            for step in result['steps']:
+                if step not in data['steps']:
+                    data['steps'].append(step)
+
+            for (step, msg) in result['messages'].items():
+                if step in data['messages']:
+                    data['messages'][step]+="\n"+msg
+                else:
+                    data['messages'][step]=msg
+        data['steps'] = list(data['steps'])
+
+        return data
+
     security.declarePrivate('_mangleTimestampName')
     def _mangleTimestampName(self, prefix, ext=None):
 



More information about the Checkins mailing list