[Checkins] SVN: z3c.password/trunk/ Preparing release 0.10.1

Adam Groszer agroszer at gmail.com
Mon Mar 28 07:01:29 EDT 2011


Log message for revision 121137:
  Preparing release 0.10.1

Changed:
  U   z3c.password/trunk/CHANGES.txt
  U   z3c.password/trunk/setup.py
  U   z3c.password/trunk/src/z3c/password/field.py
  U   z3c.password/trunk/src/z3c/password/principal.py

-=-
Modified: z3c.password/trunk/CHANGES.txt
===================================================================
--- z3c.password/trunk/CHANGES.txt	2011-03-28 06:52:36 UTC (rev 121136)
+++ z3c.password/trunk/CHANGES.txt	2011-03-28 11:01:28 UTC (rev 121137)
@@ -2,10 +2,13 @@
 CHANGES
 =======
 
-0.10.1 (unreleased)
+0.10.1 (2011-03-28)
 -------------------
 
-- Nothing changed yet.
+- Minor changes:
+  * Password field: added ignoreEmpty=False parameter
+  * previousPasswords: always set the property, not just append
+  * some caching of IPasswordOptionsUtility property usage
 
 
 0.10.0 (2010-03-24)

Modified: z3c.password/trunk/setup.py
===================================================================
--- z3c.password/trunk/setup.py	2011-03-28 06:52:36 UTC (rev 121136)
+++ z3c.password/trunk/setup.py	2011-03-28 11:01:28 UTC (rev 121137)
@@ -23,7 +23,7 @@
 
 setup (
     name='z3c.password',
-    version = '0.10.1dev',
+    version='0.10.1',
     author = "Stephan Richter, Roger Ineichen and the Zope Community",
     author_email = "zope3-dev at zope.org",
     description = "Password generation and verification utility for Zope3",

Modified: z3c.password/trunk/src/z3c/password/field.py
===================================================================
--- z3c.password/trunk/src/z3c/password/field.py	2011-03-28 06:52:36 UTC (rev 121136)
+++ z3c.password/trunk/src/z3c/password/field.py	2011-03-28 11:01:28 UTC (rev 121137)
@@ -22,8 +22,9 @@
 
 class Password(zope.schema.Password):
 
-    def __init__(self, checker=None, **kw):
+    def __init__(self, checker=None, ignoreEmpty=False, **kw):
         self._checker = checker
+        self._ignoreEmpty = ignoreEmpty
         super(Password, self).__init__(**kw)
 
     @property
@@ -36,6 +37,12 @@
             interfaces.IPasswordUtility, self._checker)
 
     def validate(self, value):
+        if not value and self._ignoreEmpty:
+            # leaving a password empty worked fine with formlib,
+            # but seems not to work with z3c.form, value get always validated
+            # but we would want to leave the old password in place
+            return
+
         super(Password, self).validate(value)
         old = None
         if self.context is not None:

Modified: z3c.password/trunk/src/z3c/password/principal.py
===================================================================
--- z3c.password/trunk/src/z3c/password/principal.py	2011-03-28 06:52:36 UTC (rev 121136)
+++ z3c.password/trunk/src/z3c/password/principal.py	2011-03-28 11:01:28 UTC (rev 121137)
@@ -67,7 +67,10 @@
                 self.previousPasswords = persistent.list.PersistentList()
 
             if self.password is not None:
-                self.previousPasswords.append(self.password)
+                # storm/custom property does not like a simple append
+                ppwd = self.previousPasswords
+                ppwd.append(self.password)
+                self.previousPasswords = ppwd
 
         self.passwordSetOn = self.now()
         self.failedAttempts = 0
@@ -213,8 +216,9 @@
         if options is None:
             return self.passwordExpiresAfter
         else:
-            if options.passwordExpiresAfter is not None:
-                return datetime.timedelta(days=options.passwordExpiresAfter)
+            days = options.passwordExpiresAfter
+            if days is not None:
+                return datetime.timedelta(days=days)
             else:
                 return self.passwordExpiresAfter
 
@@ -226,8 +230,9 @@
         if options is None:
             return self.lockOutPeriod
         else:
-            if options.lockOutPeriod is not None:
-                return datetime.timedelta(minutes=options.lockOutPeriod)
+            minutes = options.lockOutPeriod
+            if minutes is not None:
+                return datetime.timedelta(minutes=minutes)
             else:
                 return self.lockOutPeriod
 
@@ -239,8 +244,9 @@
         if options is None:
             return self.failedAttemptCheck
         else:
-            if options.failedAttemptCheck is not None:
-                return options.failedAttemptCheck
+            fac = options.failedAttemptCheck
+            if fac is not None:
+                return fac
             else:
                 return self.failedAttemptCheck
 
@@ -252,8 +258,9 @@
         if options is None:
             return self.maxFailedAttempts
         else:
-            if options.maxFailedAttempts is not None:
-                return options.maxFailedAttempts
+            count = options.maxFailedAttempts
+            if count is not None:
+                return count
             else:
                 return self.maxFailedAttempts
 
@@ -265,7 +272,8 @@
         if options is None:
             return self.disallowPasswordReuse
         else:
-            if options.disallowPasswordReuse is not None:
-                return options.disallowPasswordReuse
+            dpr = options.disallowPasswordReuse
+            if dpr is not None:
+                return dpr
             else:
                 return self.disallowPasswordReuse
\ No newline at end of file



More information about the checkins mailing list