[Checkins] SVN: Products.GenericSetup/trunk/Products/GenericSetup/ - Make sure the Import ZMI tab does not blow up if no base profile

Jens Vagelpohl jens at dataflake.org
Wed Dec 30 10:35:57 EST 2009


Log message for revision 107360:
  - Make sure the Import ZMI tab does not blow up if no base profile
    has been selected, and make it a little more user-friendly.
  
  - Log if the components handler runs and has nothing to import.
  

Changed:
  U   Products.GenericSetup/trunk/Products/GenericSetup/CHANGES.txt
  U   Products.GenericSetup/trunk/Products/GenericSetup/components.py
  U   Products.GenericSetup/trunk/Products/GenericSetup/www/sutImportSteps.zpt

-=-
Modified: Products.GenericSetup/trunk/Products/GenericSetup/CHANGES.txt
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/CHANGES.txt	2009-12-30 15:33:55 UTC (rev 107359)
+++ Products.GenericSetup/trunk/Products/GenericSetup/CHANGES.txt	2009-12-30 15:35:57 UTC (rev 107360)
@@ -4,6 +4,11 @@
 1.5.0 (unreleased)
 ------------------
 
+- Make sure the Import ZMI tab does not blow up if no base profile
+  has been selected, and make it a little more user-friendly.
+
+- Log if the components handler runs and has nothing to import.
+
 - Use five.formlib in favor of Products.Five.formlib if it is available.
 
 - Removed testing dependency on zope.app.testing.ztapi.

Modified: Products.GenericSetup/trunk/Products/GenericSetup/components.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/components.py	2009-12-30 15:33:55 UTC (rev 107359)
+++ Products.GenericSetup/trunk/Products/GenericSetup/components.py	2009-12-30 15:35:57 UTC (rev 107360)
@@ -515,6 +515,9 @@
         body = context.readDataFile('componentregistry.xml')
         if body is not None:
             importer.body = body
+        else:
+            logger = context.getLogger('componentregistry')
+            logger.debug("Nothing to import")
 
 def exportComponentRegistry(context):
     """Export local components.

Modified: Products.GenericSetup/trunk/Products/GenericSetup/www/sutImportSteps.zpt
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/www/sutImportSteps.zpt	2009-12-30 15:33:55 UTC (rev 107359)
+++ Products.GenericSetup/trunk/Products/GenericSetup/www/sutImportSteps.zpt	2009-12-30 15:35:57 UTC (rev 107360)
@@ -1,6 +1,8 @@
 <tal:block define="base_context_id context/getBaselineContextID;
                    context_id request/context_id|base_context_id;
                    contexts context/listContextInfos;
+                   base_context_title python:[c['title'] for c in contexts if c['id']==base_context_id];
+                   base_context_title python:base_context_title and base_context_title[0] or 'NOT SET';
                    context_title python:[c['title'] for c in contexts if c['id']==context_id];
                    context_title python:context_title and context_title[0] or 'UNKNOWN';
                    extension_contexts python:[c for c in contexts if c['type'] in ['extension','snapshot']];
@@ -24,7 +26,7 @@
  <option value=""
          tal:attributes="value base_context_id;
                          selected python:context_id==base_context_id">
-   Current base profile</option>
+   Current base profile (<span tal:replace="base_context_title"/>)</option>
  <option value="context-CONTEXT_ID"
     tal:repeat="context extension_contexts"
     tal:attributes="value context/id; selected python:context_id==context['id']"
@@ -37,6 +39,7 @@
   </noscript>
 </form>
 
+<div tal:condition="context_id|nothing">
 
 <h3>Available Import Steps for "<span tal:replace="context_title">Base profile</span>"</h3>
 
@@ -130,6 +133,8 @@
 </table>
 </form>
 
+</div>
+
 <h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1>
 </tal:block>
 



More information about the checkins mailing list