[Checkins] SVN: Products.CMFDefault/trunk/Products/CMFDefault/ - fixed broken reconfig_form

Yvo Schubbe cvs-admin at zope.org
Sat Mar 31 16:28:22 UTC 2012


Log message for revision 124824:
  - fixed broken reconfig_form

Changed:
  U   Products.CMFDefault/trunk/Products/CMFDefault/CHANGES.txt
  U   Products.CMFDefault/trunk/Products/CMFDefault/skins/zpt_control/portal_config_control.py
  U   Products.CMFDefault/trunk/Products/CMFDefault/skins/zpt_generic/reconfig_form.py
  U   Products.CMFDefault/trunk/Products/CMFDefault/skins/zpt_generic/reconfig_template.pt
  U   Products.CMFDefault/trunk/Products/CMFDefault/upgrade/configure.zcml
  U   Products.CMFDefault/trunk/Products/CMFDefault/upgrade/to23.py

-=-
Modified: Products.CMFDefault/trunk/Products/CMFDefault/CHANGES.txt
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/CHANGES.txt	2012-03-30 19:43:08 UTC (rev 124823)
+++ Products.CMFDefault/trunk/Products/CMFDefault/CHANGES.txt	2012-03-31 16:28:18 UTC (rev 124824)
@@ -4,7 +4,10 @@
 2.3.0 (unreleased)
 ------------------
 
+- skins and upgrade: Fixed broken reconfig_form.
+  Added upgrade step for fixing site properties corrupted by that form.
 
+
 2.3.0-beta (2012-03-21)
 -----------------------
 
@@ -72,6 +75,7 @@
 - SyndicationTool: Updated to produce RSS 2.0. Uses an adapter for
   syndication information.
 
+
 2.2.0-beta (2009-12-06)
 -----------------------
 

Modified: Products.CMFDefault/trunk/Products/CMFDefault/skins/zpt_control/portal_config_control.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/skins/zpt_control/portal_config_control.py	2012-03-30 19:43:08 UTC (rev 124823)
+++ Products.CMFDefault/trunk/Products/CMFDefault/skins/zpt_control/portal_config_control.py	2012-03-31 16:28:18 UTC (rev 124824)
@@ -5,10 +5,8 @@
 
 ptool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IPropertiesTool')
 
-if not ptool.hasProperty('enable_actionicons'):
-    ptool.manage_addProperty('enable_actionicons', '', 'boolean')
-
 kw.setdefault('enable_actionicons', False)
+kw.setdefault('enable_permalink', False)
 
 ptool.editProperties(kw)
 

Modified: Products.CMFDefault/trunk/Products/CMFDefault/skins/zpt_generic/reconfig_form.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/skins/zpt_generic/reconfig_form.py	2012-03-30 19:43:08 UTC (rev 124823)
+++ Products.CMFDefault/trunk/Products/CMFDefault/skins/zpt_generic/reconfig_form.py	2012-03-31 16:28:18 UTC (rev 124824)
@@ -19,7 +19,7 @@
 
 target = atool.getActionInfo('global/configPortal')['url']
 buttons = []
-buttons.append( {'name': 'change', 'value': _(u'Change')} )
+buttons.append({'name': 'change', 'value': _(u'Change')})
 options['form'] = { 'action': target,
                     'email_from_name': ptool.getProperty('email_from_name'),
                     'email_from_address':
@@ -32,7 +32,7 @@
                     'email_charset': ptool.getProperty('email_charset'),
                     'enable_actionicons':
                                       ptool.getProperty('enable_actionicons'),
-                    'enable-permalink':ptool.getProperty('enable_permalink'),
+                    'enable_permalink': ptool.getProperty('enable_permalink'),
                     'listButtonInfos': tuple(buttons) }
 
 return context.reconfig_template(**decode(options, script))

Modified: Products.CMFDefault/trunk/Products/CMFDefault/skins/zpt_generic/reconfig_template.pt
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/skins/zpt_generic/reconfig_template.pt	2012-03-30 19:43:08 UTC (rev 124823)
+++ Products.CMFDefault/trunk/Products/CMFDefault/skins/zpt_generic/reconfig_template.pt	2012-03-31 16:28:18 UTC (rev 124824)
@@ -111,7 +111,7 @@
       tal:attributes="checked form/enable_actionicons" />
    <tal:span i18n:translate="">Show action icons</tal:span>
     <dl class="FieldHelp">
-     <dd i18n:translate="">Actions available to the user are shown as 
+     <dd i18n:translate="">Actions available to the user are shown as
        textual links. With this option enabled, they are also shown as
        icons if the action definition specifies one.</dd>
     </dl>
@@ -120,11 +120,13 @@
  <tr>
   <th i18n:translate="">Permalinks</th>
   <td>
-   <input type="checkbox" name="enable_actionicons:boolean" value="True"
-      tal:attributes="checked form/enable_actionicons" />
+   <input type="checkbox" name="enable_permalink:boolean" value="True"
+      tal:attributes="checked form/enable_permalink" />
    <tal:span i18n:translate="">Show permalinks</tal:span>
     <dl class="FieldHelp">
-     <dd i18n:translate="">If permalinks are enabled then a unique identifier is assigned to every item of content independent of it's id or position in a site. This requires the CMFUid tool to be installed.</dd>
+     <dd i18n:translate="">If permalinks are enabled then a unique identifier
+       is assigned to every item of content independent of it's id or position
+       in a site. This requires the CMFUid tool to be installed.</dd>
     </dl>
     <span class="errors" tal:condition="not: globals/uidtool_installed">CMFUid is not installed</span>
   </td>

Modified: Products.CMFDefault/trunk/Products/CMFDefault/upgrade/configure.zcml
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/upgrade/configure.zcml	2012-03-30 19:43:08 UTC (rev 124823)
+++ Products.CMFDefault/trunk/Products/CMFDefault/upgrade/configure.zcml	2012-03-31 16:28:18 UTC (rev 124824)
@@ -239,6 +239,13 @@
         checker=".to23.check_syndication_tool"
         />
 
+    <genericsetup:upgradeStep
+        title="Upgrade root properties"
+        description="Fix 'enable_actionicons' property if corrupted."
+        handler=".to23.upgrade_root_properties"
+        checker=".to23.check_root_properties"
+        />
+
   </genericsetup:upgradeSteps>
 
   <genericsetup:upgradeStep

Modified: Products.CMFDefault/trunk/Products/CMFDefault/upgrade/to23.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/upgrade/to23.py	2012-03-30 19:43:08 UTC (rev 124823)
+++ Products.CMFDefault/trunk/Products/CMFDefault/upgrade/to23.py	2012-03-31 16:28:18 UTC (rev 124824)
@@ -322,7 +322,6 @@
             logger.info('Registered %s for interface %s' % (tool_id,
                                                             tool_interface))
 
-
 def DateTime_to_datetime(Zope_DateTime):
     """
     Convert from Zope DateTime to Python datetime and strip timezone
@@ -348,7 +347,6 @@
         adapter.enable()
     folder._delObject(SyndicationInformation.getId())
 
-
 def check_syndication_tool(tool):
     """Convert if portal_syndication exists"""
     portal = aq_parent(aq_inner(tool))
@@ -362,7 +360,6 @@
     if infos != []:
         return True
 
-
 def upgrade_syndication_tool(tool):
     """Replace SyndicatonInformation objects with SyndicationInfo adapters"""
     logger = logging.getLogger('GenericSetup.upgrade')
@@ -375,3 +372,23 @@
                                     search_sub=True,
                                     apply_func=change_to_adapter)
     logger.info("SyndicationTool updated and SyndicationInformation replaced by Annotations")
+
+def check_root_properties(tool):
+    """2.3.0-beta to 2.3.0 upgrade step checker
+    """
+    portal = aq_parent(aq_inner(tool))
+    enable_actionicons = portal.getProperty('enable_actionicons')
+    if isinstance(enable_actionicons, tuple):
+        return True
+    return False
+
+def upgrade_root_properties(tool):
+    """2.3.0-beta to 2.3.0 upgrade step handler
+    """
+    logger = logging.getLogger('GenericSetup.upgrade')
+    portal = aq_parent(aq_inner(tool))
+    enable_actionicons = portal.getProperty('enable_actionicons')
+    if isinstance(enable_actionicons, tuple):
+        enable_actionicons = bool(enable_actionicons[0])
+        portal._updateProperty('enable_actionicons', enable_actionicons)
+        logger.info("'enable_actionicons' property fixed.")



More information about the checkins mailing list