[Erp5-report] r27638 - /erp5/trunk/products/ERP5/Document/Person.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jun 17 17:49:34 CEST 2009


Author: vincent
Date: Wed Jun 17 17:49:33 2009
New Revision: 27638

URL: http://svn.erp5.org?rev=27638&view=rev
Log:
Make getPassword default value behave consistently between cases where password is of Persistent Mapping type and cases where it is not.

Modified:
    erp5/trunk/products/ERP5/Document/Person.py

Modified: erp5/trunk/products/ERP5/Document/Person.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Person.py?rev=27638&r1=27637&r2=27638&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Person.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Person.py [utf8] Wed Jun 17 17:49:33 2009
@@ -243,27 +243,23 @@
           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




More information about the Erp5-report mailing list