Remove unused isAccountAvailable function
authorSverre Rabbelier <srabbelier@gmail.com>
Thu, 26 Feb 2009 16:53:36 +0000
changeset 1519 eb70b27696de
parent 1518 f6f43a1675eb
child 1520 ac407f5b10dc
Remove unused isAccountAvailable function Patch by: Sverre Rabbelier
app/soc/logic/accounts.py
--- a/app/soc/logic/accounts.py	Thu Feb 26 16:53:05 2009 +0000
+++ b/app/soc/logic/accounts.py	Thu Feb 26 16:53:36 2009 +0000
@@ -78,38 +78,3 @@
     return False
   
   return user.is_developer
-
-
-def isAccountAvailable(new_account,
-                       existing_user=None, existing_key_name=None):
-  """Returns True if Google Account is available for use by existing User.
-  
-  Args:
-    new_account: a Google Account (users.User) object with a (possibly)
-      new email
-    existing_user: an existing User entity; default is None, in which case
-      existing_key_name is used to look up the User entity
-    existing_key_name: the key_name of an existing User entity, used
-      when existing_user is not supplied; default is None
-  """
-  if not existing_user:
-    existing_user = models.user.logic.getFromKeyName(existing_key_name)
-
-  if existing_user:
-    old_email = existing_user.account.email()
-  else:
-    old_email = None
-
-  if new_account.email().lower() == old_email.lower():
-    # "new" email is same as existing User wanting it, so it is "available"
-    return True
-  # else: "new" email truly is new to the existing User, so keep checking
-
-  if not models.user.logic.getForFields({'account': new_account},
-                                        unique=True):
-    # new email address also does not belong to any other User,
-    # so it is available
-    return True
-
-  # email does not already belong to this User, but to some other User
-  return False