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

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


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

Modified Files:
      Tag: Zope-2_6-branch
	testHTMLTests.py 
Log Message:
Merge from HEAD:

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.14.2.1 => 1.14.2.2 ===
--- Zope/lib/python/Products/PageTemplates/tests/testHTMLTests.py:1.14.2.1	Wed Sep 18 10:54:11 2002
+++ Zope/lib/python/Products/PageTemplates/tests/testHTMLTests.py	Thu Jan 30 13:57:05 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: