[Zope3-checkins] CVS: Zope3/src/zope/configuration - fields.py:1.15

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Aug 18 17:45:26 EDT 2003


Update of /cvs-repository/Zope3/src/zope/configuration
In directory cvs.zope.org:/tmp/cvs-serv12699/configuration

Modified Files:
	fields.py 
Log Message:
Made extract.py work with message ids that have default values. Default 
values will be added as comments above the message string. Had to update
the ZCML and TAL stuff to make this feature useful.


=== Zope3/src/zope/configuration/fields.py 1.14 => 1.15 ===
--- Zope3/src/zope/configuration/fields.py:1.14	Mon Aug 18 15:42:25 2003
+++ Zope3/src/zope/configuration/fields.py	Mon Aug 18 16:44:52 2003
@@ -348,6 +348,10 @@
                  u'Hello world!': [('file location', 8),
                                    ('file location', 8)]}}
 
+    >>> from zope.i18n.messageid import MessageID
+    >>> isinstance(context.i18n_strings['testing'].keys()[0], MessageID)
+    True
+
     Explicit Message IDs
 
     >>> i = field.fromUnicode(u'[View-Permission] View')
@@ -387,14 +391,6 @@
             default = v[end+2:]
             v = v[1:end]
 
-        # Record the string we got for the domain
-        i18n_strings = context.i18n_strings
-        strings = i18n_strings.get(domain)
-        if strings is None:
-            strings = i18n_strings[domain] = {}
-        locations = strings.setdefault(v, [])
-        locations.append((context.info.file, context.info.line))
-
         # Convert to a message id, importing the factory, if necessary
         factory = self.__factories.get(domain)
         if factory is None:
@@ -402,4 +398,14 @@
             factory = zope.i18n.messageid.MessageIDFactory(domain)
             self.__factories[domain] = factory
 
-        return factory(v, default)
+        msgid = factory(v, default)
+
+        # Record the string we got for the domain
+        i18n_strings = context.i18n_strings
+        strings = i18n_strings.get(domain)
+        if strings is None:
+            strings = i18n_strings[domain] = {}
+        locations = strings.setdefault(msgid, [])
+        locations.append((context.info.file, context.info.line))
+
+        return msgid




More information about the Zope3-Checkins mailing list