[Zope3-checkins] CVS: Zope3/src/zope/configuration - fields.py:1.12
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Aug 5 11:56:11 EDT 2003
Update of /cvs-repository/Zope3/src/zope/configuration
In directory cvs.zope.org:/tmp/cvs-serv19455/src/zope/configuration
Modified Files:
fields.py
Log Message:
oops, ran the wrong tests this morning. Fixed tests and some code.
=== Zope3/src/zope/configuration/fields.py 1.11 => 1.12 ===
--- Zope3/src/zope/configuration/fields.py:1.11 Tue Aug 5 07:59:13 2003
+++ Zope3/src/zope/configuration/fields.py Tue Aug 5 10:56:05 2003
@@ -286,9 +286,13 @@
When a string is converted to a message ID, it is also
recorded in the context.
+ >>> class Info:
+ ... file = 'file location'
+ ... line = 8
+
>>> class FauxContext:
... i18n_strings = {}
- ... info = 'file location'
+ ... info = Info()
>>> context = FauxContext()
>>> field = MessageID().bind(context)
@@ -333,16 +337,16 @@
In addition, the string has been registered with the context:
>>> context.i18n_strings
- {'testing': {u'Hello world!': ["'file location'"]}}
+ {'testing': {u'Hello world!': [('file location', 8)]}}
>>> i = field.fromUnicode(u"Foo Bar")
>>> i = field.fromUnicode(u"Hello world!")
>>> from pprint import PrettyPrinter
>>> pprint=PrettyPrinter(width=70).pprint
>>> pprint(context.i18n_strings)
- {'testing': {u'Foo Bar': ["'file location'"],
- u'Hello world!': ["'file location'",
- "'file location'"]}}
+ {'testing': {u'Foo Bar': [('file location', 8)],
+ u'Hello world!': [('file location', 8),
+ ('file location', 8)]}}
"""
implements(IFromUnicode)
@@ -356,7 +360,7 @@
domain = 'untranslated'
warnings.warn(
"You did not specify an i18n translation domain for the "\
- "'%s' field in %s" % (self.getName(), context.info )
+ "'%s' field in %s" % (self.getName(), context.info.file )
)
v = super(MessageID, self).fromUnicode(u)
More information about the Zope3-Checkins
mailing list