[Checkins] SVN: Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/ - normalized some i18n messages

Yvo Schubbe y.2011 at wcm-solutions.de
Fri Jan 14 05:14:50 EST 2011


Log message for revision 119575:
  - normalized some i18n messages
  - wrapped some long lines
  - cleaned up headers, imports and whitespace

Changed:
  UU  Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/config.py
  UU  Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/interfaces.py
  UU  Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/syndication.py
  U   Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/tests/portal_config.txt
  UU  Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/tests/test_syndication.py

-=-
Modified: Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/config.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/config.py	2011-01-14 09:49:02 UTC (rev 119574)
+++ Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/config.py	2011-01-14 10:14:50 UTC (rev 119575)
@@ -10,28 +10,25 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Portal Configuration Form"""
+"""Portal Configuration Form.
+"""
 
-from zope.component import adapts, getUtility
-from zope.interface import implements
-from zope.schema import getFieldsInOrder, getFieldNames
+from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
 from zope.formlib import form
+from zope.schema import getFieldNames
 
-from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
-
-from Products.CMFCore.interfaces import IPropertiesTool
-from Products.CMFDefault.utils import Message as _
-from Products.CMFDefault.formlib.schema import ProxyFieldProperty
-from Products.CMFDefault.formlib.form import EditFormBase, ContentEditFormBase
+from Products.CMFDefault.formlib.form import EditFormBase
 from Products.CMFDefault.formlib.widgets import ChoiceRadioWidget
+from Products.CMFDefault.utils import Message as _
 
-from interfaces import IPortalConfig
+from .interfaces import IPortalConfig
 
+
 class PortalConfig(EditFormBase):
-    
+
     form_fields = form.FormFields(IPortalConfig)
     form_fields['validate_email'].custom_widget = ChoiceRadioWidget
-    
+
     actions = form.Actions(
         form.Action(
             name='change',
@@ -40,7 +37,7 @@
             failure='handle_failure'),
     )
     template = ViewPageTemplateFile("config.pt")
-    
+
     def setUpWidgets(self, ignore_request=False):
         data = {}
         ptool = self._getTool('portal_properties')
@@ -57,9 +54,9 @@
                     self.form_fields, self.prefix,
                     self.context, self.request, data=data,
                     ignore_request=ignore_request)
-    
+
     def handle_success(self, action, data):
         ptool = self._getTool('portal_properties')
         ptool.editProperties(data)
-        self.status = _(u"Portal settings changed")
+        self.status = _(u"Portal settings changed.")
         self._setRedirect('portal_actions', 'global/configPortal')


Property changes on: Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/config.py
___________________________________________________________________
Deleted: svn:keywords
   - Id

Modified: Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/interfaces.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/interfaces.py	2011-01-14 09:49:02 UTC (rev 119574)
+++ Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/interfaces.py	2011-01-14 10:14:50 UTC (rev 119575)
@@ -1,18 +1,32 @@
-"""Schema for portal forms"""
+##############################################################################
+#
+# Copyright (c) 2010 Zope Foundation and Contributors.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Schema for portal forms.
+"""
+
 import codecs
 
 from zope.interface import Interface
-from zope.schema import TextLine, ASCIILine, Bool, Choice
+from zope.schema import ASCIILine
+from zope.schema import Bool
+from zope.schema import Choice
+from zope.schema import TextLine
 from zope.schema.vocabulary import SimpleVocabulary
 
 from Products.CMFDefault.utils import Message as _
 
-email_policy = SimpleVocabulary.fromItems(
-         [
-         (_(u"Generate and email members' initial password"), True),
-         (_(u"Allow members to select their initial password"), False)
-         ]
-         )
+email_policy = SimpleVocabulary.fromItems([
+    (_(u"Generate and email members' initial password"), True),
+    (_(u"Allow members to select their initial password"), False)])
 
 def check_encoding(value):
     encoding = ""
@@ -22,59 +36,74 @@
         pass
     return encoding != ""
 
+
 class IPortalConfig(Interface):
-    
+
+    """Schema for portal configuration form.
+    """
+
     email_from_name = TextLine(
-                        title=_(u"Portal 'From' name"),
-                        description=_(u"When the portal generates mail, it uses this name as its (apparent) sender."),
-                        required=False)
-                        
+        title=_(u"Portal 'From' name"),
+        description=_(u"When the portal generates mail, it uses this name as "
+                      u"its (apparent) sender."),
+        required=False)
+
     email_from_address = TextLine(
-                        title=_(u"Portal 'From' address"),
-                        description=_(u"When the portal generates mail, it uses this address as its (apparent) return address."),
-                        required=False)
+        title=_(u"Portal 'From' address"),
+        description=_(u"When the portal generates mail, it uses this address "
+                      u"as its (apparent) return address."),
+        required=False)
 
     smtp_server = TextLine(
-                        title=_(u"SMTP server"),
-                        description=_(u"This is the address of your local SMTP (out-going mail) server."),
-                        required=False)
-                        
+        title=_(u"SMTP server"),
+        description=_(u"This is the address of your local SMTP (out-going "
+                      u"mail) server."),
+        required=False)
+
     title = TextLine(
-                    title=_(u"Portal title"),
-                    description=_(u"This is the title which appears at the top of every portal page."),
-                    required=False)
-                    
+        title=_(u"Portal title"),
+        description=_(u"This is the title which appears at the top of every "
+                      u"portal page."),
+        required=False)
+
     description = TextLine(
-                    title=_(u"Portal description"),
-                    description=_(u"This description is made available via syndicated content and elsewhere. It should be fairly brief"),
-                    required=False)
-                    
+        title=_(u"Portal description"),
+        description=_(u"This description is made available via syndicated "
+                      u"content and elsewhere. It should be fairly brief."),
+        required=False)
+
     validate_email = Choice(
-                    title=_(u"Password policy"),
-                    vocabulary=email_policy,
-                    default=False,
-                    )
+        title=_(u"Password policy"),
+        vocabulary=email_policy,
+        default=False)
 
     default_charset = ASCIILine(
-                    title=_(u"Portal default encoding"),
-                    description=_(u"Charset used to decode portal content strings. If empty, 'utf-8' is used."),
-                    required=False,
-                    constraint=check_encoding,
-                    default="UTF-8")
-                    
+        title=_(u"Portal default encoding"),
+        description=_(u"Charset used to decode portal content strings. If "
+                      u"empty, 'utf-8' is used."),
+        required=False,
+        constraint=check_encoding,
+        default="UTF-8")
+
     email_charset = ASCIILine(
-                    title=_(u"Portal email encoding"),
-                    description=_(u"Charset used to encode emails send by the portal. If empty, 'utf-8' is used if necessary."),
-                    required=False,
-                    constraint=check_encoding,
-                    default="UTF-8")
-    
+        title=_(u"Portal email encoding"),
+        description=_(u"Charset used to encode emails send by the portal. If "
+                      u"empty, 'utf-8' is used if necessary."),
+        required=False,
+        constraint=check_encoding,
+        default="UTF-8")
+
     enable_actionicons = Bool(
-                    title=_(u"Action icons"),
-                    description=_(u"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."),
-                    required=False)
-                    
+        title=_(u"Action icons"),
+        description=_(u"Actions available to the user are shown as textual "
+                      u"links. With this option enabled, they are also shown "
+                      u"as icons if the action definition specifies one."),
+        required=False)
+
     enable_permalink = Bool(
-                    title=_(u"Permalink"),
-                    description=_(u"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."),
-                    required=False)
\ No newline at end of file
+        title=_(u"Permalinks"),
+        description=_(u"If permalinks are enabled then a unique identifier is "
+                      u"assigned to every item of content independent of it's "
+                      u"id or position in a site. This requires the CMFUid "
+                      u"tool to be installed."),
+        required=False)


Property changes on: Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/interfaces.py
___________________________________________________________________
Deleted: svn:keywords
   - Id

Modified: Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/syndication.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/syndication.py	2011-01-14 09:49:02 UTC (rev 119574)
+++ Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/syndication.py	2011-01-14 10:14:50 UTC (rev 119575)
@@ -10,22 +10,23 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Syndication configuration views"""
+"""Syndication configuration views.
+"""
 
+from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
 from zope.component import getAdapter
+from zope.formlib import form
 from zope.interface import Interface
-from zope.formlib import form
-from zope.schema import Choice, Int, Datetime
+from zope.schema import Choice
+from zope.schema import Datetime
+from zope.schema import Int
 from zope.schema.vocabulary import SimpleVocabulary
 
-from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
-
 from Products.CMFCore.interfaces import ISyndicationInfo
+from Products.CMFDefault.browser.utils import memoize
 from Products.CMFDefault.formlib.form import EditFormBase
 from Products.CMFDefault.utils import Message as _
-from Products.CMFDefault.browser.utils import memoize
 
-
 frequency_vocab = SimpleVocabulary.fromItems(
     [(_(u'Hourly'), 'hourly'),
      (_(u'Daily'), 'daily'),
@@ -36,6 +37,7 @@
 
 
 class ISyndicationSchema(Interface):
+
     """Syndication form schema"""
 
     period = Choice(
@@ -61,7 +63,9 @@
         description=_(u"")
     )
 
+
 class Site(EditFormBase):
+
     """Enable or disable syndication for a site."""
 
     form_fields = form.FormFields(ISyndicationSchema)
@@ -112,13 +116,13 @@
                 'base':self.syndtool.syUpdateBase,
                 'max_items':self.syndtool.max_items
                 }
-        self.widgets = form.setUpDataWidgets(fields, self.prefix,
-                                             self.context, self.request,data=data,
+        self.widgets = form.setUpDataWidgets(fields, self.prefix, self.context,
+                                             self.request, data=data,
                                              ignore_request=ignore_request)
 
     def handle_enable(self, action, data):
         self.syndtool.isAllowed = True
-        self.status = _(u"Syndication enabled")
+        self.status = _(u"Syndication enabled.")
         self._setRedirect("portal_actions", "global/syndication")
 
     def handle_update(self, action, data):
@@ -127,19 +131,19 @@
                                      updateBase=data['base'],
                                      max_items=data['max_items']
                                      )
-        self.status = _(u"Syndication updated")
+        self.status = _(u"Syndication settings updated.")
         self._setRedirect("portal_actions", "global/syndication")
 
     def handle_disable(self, action, data):
         self.syndtool.isAllowed = False
-        self.status = _(u"Syndication disabled")
+        self.status = _(u"Syndication disabled.")
         self._setRedirect("portal_actions", "global/syndication")
 
 
 class Syndicate(EditFormBase):
+
+    """Enable, disable and customise syndication settings for a folder.
     """
-    Enable, disable and customise syndication settings for a folder
-    """
 
     form_fields = form.FormFields(ISyndicationSchema)
     template = ViewPageTemplateFile("syndication.pt")
@@ -202,20 +206,20 @@
 
     def handle_enable(self, action, data):
         self.adapter.enable()
-        self.status = _(u"Syndication enabled")
+        self.status = _(u"Syndication enabled.")
         self._setRedirect("portal_actions", "folder/syndication")
 
     def handle_disable(self, action, data):
         self.adapter.disable()
-        self.status = _(u"Syndication disabled")
+        self.status = _(u"Syndication disabled.")
         self._setRedirect("portal_actions", "folder/syndication")
 
     def handle_update(self, action, data):
         self.adapter.set_info(**data)
-        self.status = _(u"Syndication updated")
+        self.status = _(u"Syndication settings updated.")
         self._setRedirect("portal_actions", "folder/syndication")
 
     def handle_revert(self, action, data):
         self.adapter.revert()
-        self.status = _(u"Syndication reset to site default")
+        self.status = _(u"Syndication reset to site default.")
         self._setRedirect("portal_actions", "folder/syndication")


Property changes on: Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/syndication.py
___________________________________________________________________
Deleted: svn:keywords
   - Id

Modified: Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/tests/portal_config.txt
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/tests/portal_config.txt	2011-01-14 09:49:02 UTC (rev 119574)
+++ Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/tests/portal_config.txt	2011-01-14 10:14:50 UTC (rev 119575)
@@ -24,22 +24,22 @@
     >>> browser.getControl(name="actions.login").click()
     >>> '[[cmf_default][Login success]]' in browser.contents
     True
-    
+
 Open configuration form
     >>> browser.open("http://localhost/site/@@configure.html")
     >>> "[[cmf_default][Portal Configuration]]" in browser.contents
     True
-    
+
     >>> browser.getControl(name="form.email_from_name").value = "The man behind the curtain"
     >>> browser.getControl(name="form.actions.change").click()
-    >>> "[[cmf_default][Portal settings changed]" in browser.contents
+    >>> "[[cmf_default][Portal settings changed.]" in browser.contents
     True
 
 Make sure we get open the view not the PythonScript reconfig_portal
     >>> browser.open("http://localhost/site/@@configure.html")
     >>> browser.getControl(name="form.email_from_name").value == "The man behind the curtain"
     True
-    
+
 Test for error handling, default_charset must be ASCII onlye
     >>> browser.open("http://localhost/site/@@configure.html")
     >>> browser.getControl(name="form.default_charset").value = "Caché"
@@ -49,4 +49,4 @@
     >>> browser.getControl(name="form.default_charset").value = "utf-9"
     >>> browser.getControl(name="form.actions.change").click()
     >>> "[Constraint not satisfied]" in browser.contents
-    True
\ No newline at end of file
+    True

Modified: Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/tests/test_syndication.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/tests/test_syndication.py	2011-01-14 09:49:02 UTC (rev 119574)
+++ Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/tests/test_syndication.py	2011-01-14 10:14:50 UTC (rev 119575)
@@ -10,16 +10,23 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Tests for portal syndication form"""
+"""Tests for portal syndication form.
+"""
 
 import unittest
 
+from zope.component import getSiteManager
+from zope.i18n.interfaces import IUserPreferredCharsets
 from zope.interface import alsoProvides
-from zope.i18n.interfaces import IUserPreferredCharsets
 
-from Products.CMFCore.tests.base.dummy import DummySite, DummyTool, DummyFolder
-from Products.CMFDefault.browser.test_utils import DummyRequest, DummyResponse
+from Products.CMFCore.interfaces import IFolderish
+from Products.CMFCore.interfaces import ISyndicationInfo
+from Products.CMFCore.tests.base.dummy import DummyFolder
+from Products.CMFCore.tests.base.dummy import DummySite
+from Products.CMFCore.tests.base.dummy import DummyTool
+from Products.CMFDefault.browser.test_utils import DummyRequest
 
+
 class DummySyndicationTool(object):
 
     isAllowed = False
@@ -65,15 +72,15 @@
         data = {'frequency':3, 'period':'weekly', 'base':'', 'max_items':10}
         view.handle_enable("enable", data)
         self.assertTrue(view.enabled())
-        self.assertEqual(view.status, u"Syndication enabled")
+        self.assertEqual(view.status, u"Syndication enabled.")
         self.assertEqual(view.request.RESPONSE.location,
             "http://www.foobar.com/bar/site?portal_status_message="
-            "Syndication%20enabled")
+            "Syndication%20enabled.")
 
     def test_handle_update(self):
         view = self._getTargetClass()
         self.assertEqual(view.syndtool.updatePeriod, 'daily')
-        self.assertEqual(view.syndtool.updateFrequency,  1)
+        self.assertEqual(view.syndtool.updateFrequency, 1)
         self.assertEqual(view.syndtool.updateBase, "")
         self.assertEqual(view.syndtool.max_items, 15)
         data = {'frequency':3, 'period':'weekly', 'base':'active',
@@ -83,10 +90,10 @@
         self.assertEqual(view.syndtool.updateFrequency, 3)
         self.assertEqual(view.syndtool.updateBase, "active")
         self.assertEqual(view.syndtool.max_items, 10)
-        self.assertEqual(view.status, u"Syndication updated")
+        self.assertEqual(view.status, u"Syndication settings updated.")
         self.assertEqual(view.request.RESPONSE.location,
             "http://www.foobar.com/bar/site?portal_status_message="
-            "Syndication%20updated")
+            "Syndication%20settings%20updated.")
 
     def test_handle_disable(self):
         view = self._getTargetClass()
@@ -94,20 +101,18 @@
         self.assertTrue(view.enabled)
         view.handle_disable("disable", {})
         self.assertTrue(view.disabled)
-        self.assertEqual(view.status, u"Syndication disabled")
+        self.assertEqual(view.status, u"Syndication disabled.")
         self.assertEqual(view.request.RESPONSE.location,
             "http://www.foobar.com/bar/site?portal_status_message="
-            "Syndication%20disabled")
+            "Syndication%20disabled.")
 
 
-from Products.CMFCore.interfaces import ISyndicationInfo, IFolderish
-from Products.CMFDefault.SyndicationInfo import SyndicationInfo
-
 class FolderSyndicationTests(unittest.TestCase):
 
     def setUp(self):
         """Setup a site"""
-        from zope.component import getSiteManager
+        from Products.CMFDefault.SyndicationInfo import SyndicationInfo
+
         self.site = site = DummySite('site')
         sm = getSiteManager()
         info = SyndicationInfo
@@ -130,7 +135,6 @@
         self.assertFalse(view.allowed)
 
     def test_adapter(self):
-        from Products.CMFCore.interfaces import ISyndicationInfo
         view = self._getTargetClass()
         self.assertTrue(ISyndicationInfo.providedBy(view.adapter))
 
@@ -147,10 +151,10 @@
         view = self._getTargetClass()
         view.handle_enable("enable", {})
         self.assertTrue(view.enabled())
-        self.assertEqual(view.status, u"Syndication enabled")
+        self.assertEqual(view.status, u"Syndication enabled.")
         self.assertEqual(view.request.RESPONSE.location,
             "http://www.foobar.com/bar/site?portal_status_message="
-            "Syndication%20enabled")
+            "Syndication%20enabled.")
 
     def test_handle_disable(self):
         self.site.portal_syndication.isAllowed = 1
@@ -158,10 +162,10 @@
         view.adapter.enable()
         view.handle_disable("disable", {})
         self.assertFalse(view.enabled())
-        self.assertEqual(view.status, u"Syndication disabled")
+        self.assertEqual(view.status, u"Syndication disabled.")
         self.assertEqual(view.request.RESPONSE.location,
             "http://www.foobar.com/bar/site?portal_status_message="
-            "Syndication%20disabled")
+            "Syndication%20disabled.")
 
     def test_handle_update(self):
         view = self._getTargetClass()
@@ -169,10 +173,10 @@
                   'max_items': 25}
         view.handle_update("update", values)
         self.assertEqual(view.adapter.get_info(), values)
-        self.assertEqual(view.status, u"Syndication updated")
+        self.assertEqual(view.status, u"Syndication settings updated.")
         self.assertEqual(view.request.RESPONSE.location,
             "http://www.foobar.com/bar/site?portal_status_message="
-            "Syndication%20updated")
+            "Syndication%20settings%20updated.")
 
     def test_handle_revert(self):
         view = self._getTargetClass()
@@ -181,10 +185,10 @@
         view.handle_update("update", values)
         view.handle_revert("", values)
         self.assertNotEqual(view.adapter.get_info(), values)
-        self.assertEqual(view.status, u"Syndication reset to site default")
+        self.assertEqual(view.status, u"Syndication reset to site default.")
         self.assertEqual(view.request.RESPONSE.location,
             "http://www.foobar.com/bar/site?portal_status_message="
-            "Syndication%20reset%20to%20site%20default")
+            "Syndication%20reset%20to%20site%20default.")
 
 
 def test_suite():


Property changes on: Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/tests/test_syndication.py
___________________________________________________________________
Deleted: svn:keywords
   - Id



More information about the checkins mailing list