On 12/14/06, Felix Schwarz <[EMAIL PROTECTED]> wrote:
>
> I found your blog entry[1] where you described how to override by_user_name
> but that
> didn't work for me... I just used your method but it is not called from
> SQLObjectIdentity.validate_identity. Obviously, only the SQLObject method is
> used... :-(
I think this entry[1] would be more appropriate. For your
requirements you'd need something similar to:
class User(SQLObject):
# Standard user definition here other than...
user_name = UnicodeCol(length=16, alternateID=True,
alternateMethodName="_by_user_name")
# No need for _get_user_name as it won't do anything special
def _set_user_name(self, new):
self._SO_set_user_name(self, new.lower())
@classmethod
def by_user_name(self, text):
return self._by_user_name(text.lower())
[1]: http://www.splee.co.uk/2006/06/01/idenitity-using-email-addresses/
Note that the above code was written in my mail client so it may not
work out of the box :)
Hope this helps.
Lee
--
Lee McFadden
blog: http://www.splee.co.uk
work: http://fireflisystems.com
skype: fireflisystems
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---