[Zope-CMF] Re: SVN: CMF/trunk/CMF - fixed credentialsChanged (don't use self.REQUEST)

Tres Seaver tseaver at palladion.com
Sun Jun 24 09:36:49 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yvo Schubbe wrote:
> Log message for revision 77003:
>   - fixed credentialsChanged (don't use self.REQUEST)
> 
> Changed:
>   U   CMF/trunk/CMFCore/MembershipTool.py
>   U   CMF/trunk/CMFCore/interfaces/_tools.py
>   U   CMF/trunk/CMFDefault/skins/zpt_control/change_password.py
> 
> -=-
> 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.




- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGfnNx+gerLs4ltQ4RAlWaAJ9EGwhvxUgSR+mif8pl6H+stxtuEQCgzs5B
MTJXunRRZzH4L473V1ClOoI=
=fyHi
-----END PGP SIGNATURE-----



More information about the Zope-CMF mailing list