Commit 978ecece authored by Tristan Cavelier's avatar Tristan Cavelier

Fix fails to _setEncodedPassword if password is a string

In some cases, a Person.password could be a string instead of
None or PersistentMapping. If string, the code was raising
TypeError.
parent 6ac0882f
......@@ -78,7 +78,7 @@ class EncryptedPasswordMixin:
def _setEncodedPassword(self, value, format='default'):
password = getattr(aq_base(self), 'password', None)
if password is None:
if password is None or isinstance(password, basestring):
password = self.password = PersistentMapping()
self.password[format] = value
......
  • If password is a string, then it is likely an existing password, and it must not be lost. This change overwrites it. It should indeed create a PersistentMapping, but put existing password in it too, as set format may be different from "default".

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