[Zope-Checkins]
SVN: Zope/branches/philikon-aq/lib/python/Products/Five/i18n.py
Do not attempt to acquire REQUEST from the context,
when we already got a request as the context.
Hanno Schlichting
plone at hannosch.info
Sat Jul 28 17:24:04 EDT 2007
Log message for revision 78439:
Do not attempt to acquire REQUEST from the context, when we already got a request as the context.
Changed:
U Zope/branches/philikon-aq/lib/python/Products/Five/i18n.py
-=-
Modified: Zope/branches/philikon-aq/lib/python/Products/Five/i18n.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/Products/Five/i18n.py 2007-07-28 21:09:57 UTC (rev 78438)
+++ Zope/branches/philikon-aq/lib/python/Products/Five/i18n.py 2007-07-28 21:24:03 UTC (rev 78439)
@@ -23,6 +23,7 @@
from zope.i18n.negotiator import normalize_lang
from zope.component import queryUtility
from zope.i18nmessageid import Message
+from zope.publisher.interfaces.browser import IBrowserRequest
class FiveTranslationService:
@@ -60,8 +61,11 @@
# in Zope3, context is adapted to IUserPreferredLanguages,
# which means context should be the request in this case.
+ # Do not attempt to acquire REQUEST from the context, when we already
+ # got a request as the context
if context is not None:
- context = aq_acquire(context, 'REQUEST', None)
+ if not IBrowserRequest.providedBy(context):
+ context = aq_acquire(context, 'REQUEST', None)
return util.translate(msgid, mapping=mapping, context=context,
target_language=target_language, default=default)
More information about the Zope-Checkins
mailing list