[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/ Added new translation slots

Dmitry Vasiliev dima at hlabs.spb.ru
Sun Apr 8 09:34:25 EDT 2007


Log message for revision 74038:
  Added new translation slots

Changed:
  U   Zope3/trunk/src/zope/app/schemacontent/browser/__init__.py
  U   Zope3/trunk/src/zope/app/workflow/stateful/browser/definition.py

-=-
Modified: Zope3/trunk/src/zope/app/schemacontent/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/schemacontent/browser/__init__.py	2007-04-08 12:19:42 UTC (rev 74037)
+++ Zope3/trunk/src/zope/app/schemacontent/browser/__init__.py	2007-04-08 13:34:24 UTC (rev 74038)
@@ -16,6 +16,7 @@
 $Id$
 """
 import copy
+from zope.app.i18n import ZopeMessageFactory as _
 from zope.app import zapi
 from zope.app.form.browser.add import AddView
 from zope.app.form.browser.editview import EditView
@@ -64,22 +65,22 @@
 
             # Create the Accessor Permission Widget for this field
             permField = Choice(
-                __name__=name+'_get_perm',
-                title=u"Accessor Permission",
+                __name__=name + '_get_perm',
+                title=_("Accessor Permission"),
                 default=CheckerPublic,
                 vocabulary="Permission Ids",
                 required=False)
-            setUpWidget(self, name+'_get_perm', permField, IInputWidget,
+            setUpWidget(self, name + '_get_perm', permField, IInputWidget,
                         value=get_perm_id, ignoreStickyValues=True)
 
             # Create the Mutator Permission Widget for this field
             permField = Choice(
-                __name__=name+'_set_perm',
-                title=u"Mutator Permission",
+                __name__=name + '_set_perm',
+                title=_("Mutator Permission"),
                 default=CheckerPublic,
                 vocabulary="Permission Ids",
                 required=False)
-            setUpWidget(self, name+'_set_perm', permField, IInputWidget,
+            setUpWidget(self, name + '_set_perm', permField, IInputWidget,
                         value=set_perm_id, ignoreStickyValues=True)
 
     def update(self):
@@ -92,8 +93,8 @@
             schema = self.context.schema
             perms = removeSecurityProxy(self.context.permissions)
             for name, field in getFieldsInOrder(schema):
-                getPermWidget = getattr(self, name+'_get_perm_widget')
-                setPermWidget = getattr(self, name+'_set_perm_widget')
+                getPermWidget = getattr(self, name + '_get_perm_widget')
+                setPermWidget = getattr(self, name + '_set_perm_widget')
 
                 # get the selected permission id from the from request
                 get_perm_id = getPermWidget.getInputValue()
@@ -110,7 +111,7 @@
                 getPermWidget.setRenderedValue(get_perm_id)
                 setPermWidget.setRenderedValue(set_perm_id)
 
-            status = 'Fields permissions mapping updated.'
+            status = _('Fields permissions mapping updated.')
 
         return status
 
@@ -152,7 +153,7 @@
 
         self.definition = matching[0]
         self.schema = self.definition.schema
-        self.label = 'Add %s' %self.definition.name
+        self.label = 'Add %s' % self.definition.name
         super(AddContentComponentInstanceView, self).__init__(self.context,
                                                               request)
         return self.generated_form
@@ -185,6 +186,6 @@
 
     def __init__(self, context, request):
         self.schema = context.getSchema()
-        self.label = 'Edit %s' %context.__name__
+        self.label = 'Edit %s' % context.__name__
         super(EditContentComponentInstanceView, self).__init__(context,
                                                                request)

Modified: Zope3/trunk/src/zope/app/workflow/stateful/browser/definition.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/browser/definition.py	2007-04-08 12:19:42 UTC (rev 74037)
+++ Zope3/trunk/src/zope/app/workflow/stateful/browser/definition.py	2007-04-08 13:34:24 UTC (rev 74038)
@@ -22,6 +22,7 @@
 from zope.security.checker import CheckerPublic
 from zope.security.proxy import removeSecurityProxy
 
+from zope.app.i18n import ZopeMessageFactory as _
 from zope.app.container.browser.adding import Adding
 from zope.app.form.browser.submit import Update
 from zope.app.form.browser.editview import EditView
@@ -86,22 +87,22 @@
 
                 # Create the Accessor Permission Widget for this field
                 permField = Choice(
-                    __name__=name+'_get_perm',
-                    title=u"Accessor Permission",
+                    __name__=name + '_get_perm',
+                    title=_("Accessor Permission"),
                     vocabulary="Permission Ids",
                     default=CheckerPublic,
                     required=False)
-                setUpWidget(self, name + '_get_perm', permField, IInputWidget, 
+                setUpWidget(self, name + '_get_perm', permField, IInputWidget,
                             value=get_perm_id)
 
                 # Create the Mutator Permission Widget for this field
                 permField = Choice(
-                    __name__=name+'_set_perm',
-                    title=u"Mutator Permission",
+                    __name__=name + '_set_perm',
+                    title=_("Mutator Permission"),
                     default=CheckerPublic,
                     vocabulary="Permission Ids",
                     required=False)
-                setUpWidget(self, name+'_set_perm', permField, IInputWidget, 
+                setUpWidget(self, name + '_set_perm', permField, IInputWidget,
                             value=set_perm_id)
 
     def update(self):
@@ -114,10 +115,10 @@
             schema = self.context.relevantDataSchema
             perms = removeSecurityProxy(self.context.schemaPermissions)
             for name, field in getFields(schema).items():
-                
-                getPermWidget = getattr(self, name+'_get_perm_widget')
-                setPermWidget = getattr(self, name+'_set_perm_widget')
-                
+
+                getPermWidget = getattr(self, name + '_get_perm_widget')
+                setPermWidget = getattr(self, name + '_set_perm_widget')
+
                 # get the selected permission id from the from request
                 get_perm_id = getPermWidget.getInputValue()
                 set_perm_id = setPermWidget.getInputValue()
@@ -125,18 +126,16 @@
                 # get the right permission from the given id
                 get_perm = zope.component.getUtility(IPermission, get_perm_id)
                 set_perm = zope.component.getUtility(IPermission, set_perm_id)
-                
+
                 # set the permission back to the instance
                 perms[name] = (get_perm, set_perm)
 
                 # update widget ohterwise we see the old value
                 getPermWidget.setRenderedValue(get_perm_id)
                 setPermWidget.setRenderedValue(set_perm_id)
-                
-                
-                
-            status = 'Fields permissions mapping updated.'
 
+            status = _('Fields permissions mapping updated.')
+
         return status
 
     def getPermissionWidgets(self):
@@ -149,8 +148,8 @@
             info.append(
                 {'fieldName': name,
                  'fieldTitle': field.title,
-                 'getter': getattr(self, name+'_get_perm_widget'),
-                 'setter': getattr(self, name+'_set_perm_widget')} )
+                 'getter': getattr(self, name + '_get_perm_widget'),
+                 'setter': getattr(self, name + '_set_perm_widget')} )
         return info
 
 



More information about the Zope3-Checkins mailing list