Commit 8759876e authored by Julien Muchembled's avatar Julien Muchembled

ERP5Type.Message: get a portal that is wrapped in a request container

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39219 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7ee02004
......@@ -22,6 +22,7 @@ from Products.ERP5Type.Globals import package_home
from Products.SiteErrorLog.SiteErrorLog import manage_addErrorLog
from ZPublisher import BeforeTraverse
from ZPublisher.BaseRequest import RequestContainer
from AccessControl import ClassSecurityInfo
from Products.CMFDefault.Portal import CMFSite
from Products.CMFCore.utils import getToolByName
......@@ -189,13 +190,13 @@ class _site(threading.local):
self = threading.local.__new__(cls)
return self.__get, self.__set
def __get(self):
"""Returns the currently processed site
XXX The returned site is not wrapped in a request.
def __get(self, REQUEST=None):
"""Returns the currently processed site, optionally wrapped in a request
"""
app, site_id = self.site[-1]
if REQUEST is None:
return getattr(app(), site_id)
return getattr(app().__of__(RequestContainer(REQUEST=REQUEST)), site_id)
def __set(self, site):
app = aq_base(site.aq_parent)
......
......@@ -146,11 +146,12 @@ class Message(Persistent):
message = Template(message).substitute(self.mapping)
else:
from Products.ERP5.ERP5Site import getSite
request = Globals.get_request()
translated_message = translation_service_translate(
self.domain,
message,
mapping=self.mapping,
context=getSite(),
context=getSite(request),
default=self.default)
if translated_message is not None:
message = translated_message
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment