app/soc/logic/cleaning.py
changeset 1242 c5ca70606850
parent 1217 aeabe6bed55b
child 1285 d54f2d80f46e
equal deleted inserted replaced
1241:5e25cd6abe09 1242:c5ca70606850
   214     -Another User has the given email address as account
   214     -Another User has the given email address as account
   215     -Another User has the given email address in it's FormerAccounts list
   215     -Another User has the given email address in it's FormerAccounts list
   216   """
   216   """
   217   def wrapper(self):
   217   def wrapper(self):
   218     cleaned_data = self.cleaned_data
   218     cleaned_data = self.cleaned_data
   219     
   219 
   220     link_id = cleaned_data.get(link_id_field)
   220     link_id = cleaned_data.get(link_id_field)
   221     user_account = cleaned_data.get(account_field)
   221     user_account = cleaned_data.get(account_field)
   222 
   222 
   223     # if both fields were valid do this check
   223     # if both fields were valid do this check
   224     if link_id and user_account:
   224     if link_id and user_account:
   227       user_entity = user_logic.logic.getForFields(fields, unique=True)
   227       user_entity = user_logic.logic.getForFields(fields, unique=True)
   228 
   228 
   229       former_accounts = user_entity.former_accounts
   229       former_accounts = user_entity.former_accounts
   230 
   230 
   231       # if it's not the user's current account or one of his former accounts
   231       # if it's not the user's current account or one of his former accounts
   232       if (user_entity.account != user_account  and 
   232       if user_entity.account != user_account:
   233           user_account not in former_accounts):
       
   234 
   233 
   235         # get the user having the given account
   234         # get the user having the given account
   236         fields = {'account': user_account}
   235         fields = {'account': user_account}
   237         user_from_account_entity = user_logic.logic.getForFields(fields, 
   236         user_from_account_entity = user_logic.logic.getForFields(fields, 
   238             unique=True)
   237             unique=True)