[Checkins] SVN: GenericSetup/branches/ra_profile_mgmt/ * set appropriate properties when 'runAllImportSteps' is called and display

Rob Miller ra at burningman.com
Tue Mar 28 19:00:40 EST 2006


Log message for revision 66253:
  * set appropriate properties when 'runAllImportSteps' is called and display
    applied profiles on setup tool properties tab
  
  

Changed:
  U   GenericSetup/branches/ra_profile_mgmt/tool.py
  U   GenericSetup/branches/ra_profile_mgmt/www/sutProperties.zpt

-=-
Modified: GenericSetup/branches/ra_profile_mgmt/tool.py
===================================================================
--- GenericSetup/branches/ra_profile_mgmt/tool.py	2006-03-28 21:49:21 UTC (rev 66252)
+++ GenericSetup/branches/ra_profile_mgmt/tool.py	2006-03-29 00:00:39 UTC (rev 66253)
@@ -28,6 +28,7 @@
 from zope.interface import implements
 from zope.interface import implementedBy
 
+from interfaces import BASE
 from interfaces import EXTENSION
 from interfaces import ISetupTool
 from interfaces import SKIPPED_FILES
@@ -255,6 +256,26 @@
             messages[step] = '\n'.join(message_list)
             context.clearNotes()
 
+        if self._import_context_id.startswith('profile-'):
+            context_id = self._import_context_id[len('profile-'):]
+            info = self.getProfileInfo(context_id)
+            if info['type'] == BASE:
+                propname = 'applied_base_profile'
+                if not self.hasProperty(propname):
+                    self._setProperty(propname, context_id)
+                else:
+                    self._setPropValue(propname, context_id)
+            elif info['type'] == EXTENSION:
+                propname = 'applied_extension_profiles'
+                ext_profiles = self.getProperty(propname)
+                if ext_profiles is None:
+                    self._setProperty(propname, [context_id], 'lines')
+                elif context_id not in ext_profiles:
+                    ext_profiles = list(ext_profiles)
+                    ext_profiles.append(context_id)
+                    self._setPropValue('applied_extension_profiles',
+                                      ext_profiles)
+
         return { 'steps' : steps, 'messages' : messages }
 
     security.declareProtected(ManagePortal, 'runExportStep')
@@ -522,6 +543,12 @@
         """
         return _profile_registry.listProfileInfo()
 
+    security.declareProtected(ManagePortal, 'getProfileInfo')
+    def getProfileInfo(self, profile_id):
+        """ Return the mapping for a specified profile.
+        """
+        return _profile_registry.getProfileInfo(profile_id)
+
     security.declareProtected(ManagePortal, 'listContextInfos')
     def listContextInfos(self):
 
@@ -617,9 +644,8 @@
         encoding = self.getEncoding()
 
         if context_id.startswith('profile-'):
-
             context_id = context_id[len('profile-'):]
-            info = _profile_registry.getProfileInfo(context_id)
+            info = self.getProfileInfo(context_id)
 
             if info.get('product'):
                 path = os.path.join(self._getProductPath(info['product'])

Modified: GenericSetup/branches/ra_profile_mgmt/www/sutProperties.zpt
===================================================================
--- GenericSetup/branches/ra_profile_mgmt/www/sutProperties.zpt	2006-03-28 21:49:21 UTC (rev 66252)
+++ GenericSetup/branches/ra_profile_mgmt/www/sutProperties.zpt	2006-03-29 00:00:39 UTC (rev 66253)
@@ -34,4 +34,28 @@
 </table>
 </form>
 
+
+<table>
+
+  <tr valign="top">
+    <td>
+      <div class="form-label">Applied Base Profile:</div>
+    </td>
+    <td>
+      <div tal:content="python:context.getProperty('applied_base_profile')" />
+    </td>
+  </tr>
+
+  <tr valign="top">
+    <td>
+      <div class="form-label">Applied Extension Profiles:</div>
+    </td>
+    <td>
+      <div tal:repeat="extension python:context.getProperty('applied_extension_profiles', [])"
+           tal:content="extension" />
+    </td>
+  </tr>
+
+</table>
+
 <h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1>



More information about the Checkins mailing list