equal
deleted
inserted
replaced
234 link_name = self.cleaned_data.get('link_name') |
234 link_name = self.cleaned_data.get('link_name') |
235 if not validate.isLinkNameFormatValid(link_name): |
235 if not validate.isLinkNameFormatValid(link_name): |
236 raise forms.ValidationError("This link name is in wrong format.") |
236 raise forms.ValidationError("This link name is in wrong format.") |
237 |
237 |
238 key_name = self.data.get('key_name') |
238 key_name = self.data.get('key_name') |
239 user = models.user.logic.getFromKeyName(key_name) |
239 if key_name: |
240 |
240 key_name_user = user_logic.logic.getFromKeyName(key_name) |
241 linkname_user_exist = models.user.logic.getForFields( |
241 |
242 {'link_name': link_name}, unique=True) |
242 if link_name_user and key_name_user and \ |
243 |
243 link_name_user.account != key_name_user.account: |
244 if (user and user.link_name != link_name) and linkname_user_exist: |
244 raise forms.ValidationError("This link name is already in use.") |
245 raise forms.ValidationError("This link name is already in use.") |
|
246 |
245 |
247 return link_name |
246 return link_name |
248 |
247 |
249 def clean_account(self): |
248 def clean_account(self): |
250 form_account = users.User(email=self.cleaned_data.get('account')) |
249 form_account = users.User(email=self.cleaned_data.get('account')) |