Commit cf82ae09 authored by Romain Courteaud's avatar Romain Courteaud

Bug fix: default must not be initialized to None.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6451 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent be1e7cfa
......@@ -59,11 +59,13 @@ class Message(Persistent):
security = ClassSecurityInfo()
security.declareObjectPublic()
def __init__(self, domain = None, message = '',
mapping = None, default = None):
def __init__(self, domain=None, message='',
mapping=None, default=None):
self.message = message
self.mapping = mapping
self.domain = domain
if default is None:
default = message
self.default = default
security.declarePublic('dump')
......@@ -93,8 +95,8 @@ class Message(Persistent):
if self.domain is None or translation_service is None :
# Map the translated string with given parameters
if type(self.mapping) is type({}):
if isinstance(translated_str, unicode) :
translated_str = self.message.encode('utf8')
if isinstance(self.message, unicode) :
self.message = self.message.encode('utf8')
self.message = Template(self.message).substitute(mapping)
if not isinstance(self.message, unicode):
self.message = self.message.decode('utf8')
......
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