# HG changeset patch # User Sverre Rabbelier # Date 1235667248 0 # Node ID ac407f5b10dc54301f4eccf0f5c2e4af6fd7c60a # Parent eb70b27696deac56ca7c61af4ba20108493c0f09 Add a normalizeAccount to logic.accounts Patch by: Sverre Rabbelier diff -r eb70b27696de -r ac407f5b10dc app/soc/logic/accounts.py --- a/app/soc/logic/accounts.py Thu Feb 26 16:53:36 2009 +0000 +++ b/app/soc/logic/accounts.py Thu Feb 26 16:54:08 2009 +0000 @@ -30,6 +30,17 @@ import soc.logic.models.user +def normalizeAccount(account): + """Returns a normalized version of the specified account. + """ + + normalized = str(account).lower() + + if account.email() == normalized: + return account + + return users.User(email=normalized) + def isDeveloper(account=None, user=None): """Returns True if a Google Account is a Developer with special privileges.