[Zope3-checkins] CVS: Zope3/src/zope/app/pagetemplate - engine.py:1.26

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Mar 8 18:36:03 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/pagetemplate
In directory cvs.zope.org:/tmp/cvs-serv5173/src/zope/app/pagetemplate

Modified Files:
	engine.py 
Log Message:



=== Zope3/src/zope/app/pagetemplate/engine.py 1.25 => 1.26 ===
--- Zope3/src/zope/app/pagetemplate/engine.py:1.25	Wed Mar  3 21:08:31 2004
+++ Zope3/src/zope/app/pagetemplate/engine.py	Mon Mar  8 18:35:32 2004
@@ -17,8 +17,6 @@
 
 $Id$
 """
-__metaclass__ = type # All classes are new style when run with Python 2.2+
-
 import sys
 from types import StringTypes
 
@@ -26,12 +24,11 @@
 from zope.tales.pythonexpr import PythonExpr
 from zope.tales.tales import ExpressionEngine, Context
 
-from zope.component.servicenames import Utilities
 from zope.component.exceptions import ComponentLookupError
 from zope.proxy import removeAllProxies
 from zope.security.proxy import ProxyFactory
 from zope.security.builtins import RestrictedBuiltins
-from zope.i18n.translate import Translator
+from zope.i18n import translate
 
 from zope.app import zapi
 from zope.app.i18n import ZopeMessageIDFactory as _
@@ -86,9 +83,8 @@
         # When running Zope, request is a Proxy, but no mutation is done here,
         # so it is safe to remove all proxies
         request = removeAllProxies(self.request)
-        # XXX should we cache the translator instance?
-        translator = Translator(domain, request, self.context)
-        return translator.translate(msgid, mapping, default=default)
+        return translate(self.context, msgid, domain, mapping,
+                         context=request, default=default)
 
     evaluateInlineCode = False
 
@@ -99,8 +95,7 @@
                     'you cannot have inline code snippets in your Page '
                     'Template. Activate Inline Code Evaluation and try again.')
 
-        service = zapi.getService(self.context, Utilities)
-        interpreter = service.queryUtility(IInterpreter, name=lang)
+        interpreter = zapi.queryUtility(self.context, IInterpreter, name=lang)
         if interpreter is None:
             error = _('No interpreter named "${lang_name}" was found.')
             error.mapping = {'lang_name': lang}
@@ -150,7 +145,7 @@
 
 Engine = _Engine()
 
-class AppPT:
+class AppPT(object):
 
     # Use our special engine
     pt_getEngineContext = Engine.getContext




More information about the Zope3-Checkins mailing list