app/soc/logic/cleaning.py
changeset 2365 a66e1dd8ced7
parent 2329 4e487ffd4102
child 2716 9921ac952f13
equal deleted inserted replaced
2364:a1cbd3143277 2365:a66e1dd8ced7
   189     """Decorator wrapper method.
   189     """Decorator wrapper method.
   190     """
   190     """
   191     link_id = clean_link_id(field_name)(self)
   191     link_id = clean_link_id(field_name)(self)
   192 
   192 
   193     user_entity = user_logic.getForCurrentAccount()
   193     user_entity = user_logic.getForCurrentAccount()
   194 
   194     # pylint: disable-msg=E1103
   195     if not user_entity or user_entity.link_id != link_id:
   195     if not user_entity or user_entity.link_id != link_id:
   196       # this user is not the current user
   196       # this user is not the current user
   197       raise forms.ValidationError("This user is not you.")
   197       raise forms.ValidationError("This user is not you.")
   198 
   198 
   199     return user_entity if as_user else link_id
   199     return user_entity if as_user else link_id
   232     """
   232     """
   233     clean_user_field = clean_existing_user(field_name)
   233     clean_user_field = clean_existing_user(field_name)
   234     user_entity = clean_user_field(self)
   234     user_entity = clean_user_field(self)
   235 
   235 
   236     current_user_entity = user_logic.getForCurrentAccount()
   236     current_user_entity = user_logic.getForCurrentAccount()
   237 
   237     # pylint: disable-msg=E1103
   238     if user_entity.key() == current_user_entity.key():
   238     if user_entity.key() == current_user_entity.key():
   239       # users are equal
   239       # users are equal
   240       raise forms.ValidationError("You cannot enter yourself here.")
   240       raise forms.ValidationError("You cannot enter yourself here.")
   241 
   241 
   242     return user_entity
   242     return user_entity
   532       # get the current user
   532       # get the current user
   533       user_entity = user_logic.getForCurrentAccount()
   533       user_entity = user_logic.getForCurrentAccount()
   534 
   534 
   535       # if the proposal has not been accepted or it's not the applicant
   535       # if the proposal has not been accepted or it's not the applicant
   536       # creating the new group then show link ID in use message
   536       # creating the new group then show link ID in use message
       
   537       # pylint: disable-msg=E1103
   537       if group_app_entity and (group_app_entity.status != 'accepted' or (
   538       if group_app_entity and (group_app_entity.status != 'accepted' or (
   538           group_app_entity.applicant.key() != user_entity.key())):
   539           group_app_entity.applicant.key() != user_entity.key())):
   539         # add the error message to the link id field
   540         # add the error message to the link id field
   540         self._errors[link_id_field] = ErrorList([DEF_LINK_ID_IN_USE_MSG])
   541         self._errors[link_id_field] = ErrorList([DEF_LINK_ID_IN_USE_MSG])
   541         del cleaned_data[link_id_field]
   542         del cleaned_data[link_id_field]
   686 
   687 
   687     params = view.getParams()
   688     params = view.getParams()
   688     rights = params['rights']
   689     rights = params['rights']
   689 
   690 
   690     user = user_logic.getForCurrentAccount()
   691     user = user_logic.getForCurrentAccount()
   691 
   692     
       
   693     # pylint: disable-msg=E1103
   692     rights.setCurrentUser(user.account, user)
   694     rights.setCurrentUser(user.account, user)
   693 
   695 
   694     prefix = self.cleaned_data['prefix']
   696     prefix = self.cleaned_data['prefix']
   695     scope_path = self.cleaned_data['scope_path']
   697     scope_path = self.cleaned_data['scope_path']
   696 
   698