Working my way through the Identity system, wrt model.py, I see that
the _set_password(self, method in the User class is redefining the
python built-in keyword, hash(1)

   def _set_password(self, cleartext_password):
       "Runs cleartext_password through the hash algorithm before saving."
       hash = identity.encrypt_password(cleartext_password)
       self._SO_set_password(hash)

Is it really intended to redefine the built-in?  If so, it is not
clear why it is being done.  If that is not the intention, which I
suspect is the case, then this bit of code is more confusing than it
needs to be and I would suggest that it be changed to something that
is less likely to cause confusion/unwanted side-effects.

   def _set_password(self, cleartext_password):
       "Runs cleartext_password through the hash algorithm before saving."
       password_hash = identity.encrypt_password(cleartext_password)
       self._SO_set_password(password_hash)

-jeff

ps. I've also noticed a tendency to use wildcard imports -- I'm not a
big fan of that and once you work on a big enough project with 3rd
party components -- I suspect you won't be either.

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it."
-- Brian W. Kernighan

(1)Help on built-in function hash in module __builtin__:

hash(...)
   hash(object) -> integer

   Return a hash value for the object.  Two objects with the same value have
   the same hash value.  The reverse is not necessarily true, but likely.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to