[Zope3-checkins] SVN: Zope3/trunk/src/zope/ Forward port from 3.3
branch:
Philipp von Weitershausen
philikon at philikon.de
Sun May 21 07:41:30 EDT 2006
Log message for revision 68203:
Forward port from 3.3 branch:
------------------------------------------------------------------------
r68201 | philikon | 2006-05-21 13:23:41 +0200 (Sun, 21 May 2006) | 5 lines
The default Context implementation wasn't fully complying with ITALExpressionEngine,
it was missing the 'translate()' method. THus, when using it without any customizations
(zope.app and Zope2 do customize the Context, so it's not a problem there), you'd
get an error. A test in zope.pagetemplate exercises this now.
Changed:
A Zope3/trunk/src/zope/pagetemplate/tests/input/translation.html
A Zope3/trunk/src/zope/pagetemplate/tests/output/translation.html
U Zope3/trunk/src/zope/pagetemplate/tests/test_htmltests.py
U Zope3/trunk/src/zope/tales/tales.py
-=-
Copied: Zope3/trunk/src/zope/pagetemplate/tests/input/translation.html (from rev 68201, Zope3/branches/3.3/src/zope/pagetemplate/tests/input/translation.html)
Copied: Zope3/trunk/src/zope/pagetemplate/tests/output/translation.html (from rev 68201, Zope3/branches/3.3/src/zope/pagetemplate/tests/output/translation.html)
Modified: Zope3/trunk/src/zope/pagetemplate/tests/test_htmltests.py
===================================================================
--- Zope3/trunk/src/zope/pagetemplate/tests/test_htmltests.py 2006-05-21 11:38:38 UTC (rev 68202)
+++ Zope3/trunk/src/zope/pagetemplate/tests/test_htmltests.py 2006-05-21 11:41:29 UTC (rev 68203)
@@ -124,7 +124,17 @@
out = t()
util.check_html(expect, out)
+ def test_translation(self):
+ from zope.i18nmessageid import MessageFactory
+ _ = MessageFactory('pttest')
+ msg = _("Translate this!")
+ t = self.folder.t
+ t.write(util.read_input('translation.html'))
+ expect = util.read_output('translation.html')
+ out = t(msg=msg)
+ util.check_html(expect, out)
+
def test_suite():
return unittest.makeSuite(HTMLTests)
Modified: Zope3/trunk/src/zope/tales/tales.py
===================================================================
--- Zope3/trunk/src/zope/tales/tales.py 2006-05-21 11:38:38 UTC (rev 68202)
+++ Zope3/trunk/src/zope/tales/tales.py 2006-05-21 11:41:29 UTC (rev 68203)
@@ -730,7 +730,12 @@
def setPosition(self, position):
self.position = position
+ def translate(self, msgid, domain=None, mapping=None, default=None):
+ # custom Context implementations are supposed to customize
+ # this to call whichever translation routine they want to use
+ return unicode(msgid)
+
class TALESTracebackSupplement(object):
"""Implementation of zope.exceptions.ITracebackSupplement"""
More information about the Zope3-Checkins
mailing list