Tres Seaver wrote:
Modified: CMF/trunk/CMFCore/MembershipTool.py
===================================================================
--- CMF/trunk/CMFCore/MembershipTool.py 2007-06-24 07:49:57 UTC (rev 77002)
+++ CMF/trunk/CMFCore/MembershipTool.py 2007-06-24 07:55:55 UTC (rev 77003)
@@ -316,21 +316,23 @@
         return _checkPermission(permissionName, object)
security.declarePublic('credentialsChanged')
-    def credentialsChanged(self, password):
+    def credentialsChanged(self, password, REQUEST=None):
         '''
         Notifies the authentication mechanism that this user has changed
         passwords.  This can be used to update the authentication cookie.
         Note that this call should *not* cause any change at all to user
         databases.
         '''
+        if REQUEST is None:
+            raise TypeError('new REQUEST argument required')
+


This is not a valid use of TypeError:  either the argument is required,
in which case no default should be supplied, or it is optional, in which
case the method must do something sensible with the default value.
Trying to have it both ways is a recipe for confusion and disaster.

I replaced this TypeError by BBB code and a deprecation warning, so for now this is resolved.

In general we might need a pattern like that if other optional arguments come before REQUEST and we want to make REQUEST required. I don't think changing the argument order is less confusing.

Cheers, Yuppie

_______________________________________________
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to