[Zope-Checkins] CVS: Zope/lib/python/Products/PageTemplates/tests - testHTMLTests.py:1.16

Florent Guillaume fg@nuxeo.com
Thu, 30 Jan 2003 13:19:11 -0500


Update of /cvs-repository/Zope/lib/python/Products/PageTemplates/tests
In directory cvs.zope.org:/tmp/cvs-serv6732/lib/python/Products/PageTemplates/tests

Modified Files:
	testHTMLTests.py 
Log Message:
I18n interpolation now tries to deal with the case where there is a mix
of Unicode and non-ascii string that are incompatible (because the
encoding of the latter is unknown) by substituting a representation of
the non-ascii string.

I18n interpolation doesn't fail anymore if a i18n:name is not provided,
the ${string} in the translation is just left as is.

Collector #696: tal:replace of a non-string (a number for examlpe)
associated with a i18n:name failed to be interpolated properly.

Improved tests for i18n and added tests for interpolate().



=== Zope/lib/python/Products/PageTemplates/tests/testHTMLTests.py 1.15 => 1.16 ===
--- Zope/lib/python/Products/PageTemplates/tests/testHTMLTests.py:1.15	Wed Sep 18 11:12:46 2002
+++ Zope/lib/python/Products/PageTemplates/tests/testHTMLTests.py	Thu Jan 30 13:18:39 2003
@@ -28,8 +28,14 @@
     pass
 
 class TestTranslationService:
-    def translate(self, domain, msgid, *args, **kw):
-        return "[%s](%s)" % (domain, msgid)
+    def translate(self, domain, msgid, mapping=None, *args, **kw):
+        maps = []
+        if mapping is not None:
+            # Get a deterministic, sorted representation of dicts.
+            for k, v in mapping.items():
+                maps.append('%s:%s' % (`k`, `v`))
+            maps.sort()
+        return "[%s](%s/{%s})" % (domain, msgid, ','.join(maps))
 
 
 class UnitTestSecurityPolicy: