diff --git a/product/ERP5Type/Message.py b/product/ERP5Type/Message.py index a7a956b2371f54a46817f18e681b37ee9aa07ec8..fe13bb9c49b6ddd612f0cc21ae49b4feed4aa248 100644 --- a/product/ERP5Type/Message.py +++ b/product/ERP5Type/Message.py @@ -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) -