Commit a446eebf authored by Vincent Pelletier's avatar Vincent Pelletier

Make getPassword default value behave consistently between cases where...

Make getPassword default value behave consistently between cases where password is of Persistent Mapping type and cases where it is not.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27638 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5ec0d9eb
......@@ -243,27 +243,23 @@ class Person(XMLObject):
Default: 'default'
"""
marker = []
if len(args):
default_password = args[0]
else:
default_password = None
password = getattr(aq_base(self), 'password', marker)
if password is marker:
if len(args):
password = args[0]
else:
password = None
password = default_password
else:
format = kw.get('format', 'default')
# Backward compatibility: if it's not a PersistentMapping instance,
# assume it's a monovalued string, which corresponds to default
# password encoding.
if isinstance(password, PersistentMapping):
password = password.get(format, marker)
if password is marker:
if len(args):
password = args[0]
else:
password = None
password = password.get(format, default_password)
else:
if format != 'default':
password = None
password = default_password
return password
# Time management
......
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