Commit 5b82e384 authored by Aurel's avatar Aurel

check if request is not None when rendering message to string


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6477 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2e2f1943
......@@ -90,9 +90,11 @@ class Message(Persistent):
"""
Return the translated message
"""
context = get_request()['PARENTS'][0]
translation_service = getGlobalTranslationService()
if self.domain is None or translation_service is None :
request = get_request()
if request is not None:
context = request['PARENTS'][0]
translation_service = getGlobalTranslationService()
if self.domain is None or request is None or translation_service is None :
# Map the translated string with given parameters
if type(self.mapping) is type({}):
if isinstance(self.message, unicode) :
......@@ -115,4 +117,3 @@ class Message(Persistent):
InitializeClass(Message)
allow_class(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