equal
deleted
inserted
replaced
35 in the proper format, and verifies that the link_id is not already in |
35 in the proper format, and verifies that the link_id is not already in |
36 in use by another entity of the same type. |
36 in use by another entity of the same type. |
37 """ |
37 """ |
38 |
38 |
39 def wrapped(self): |
39 def wrapped(self): |
40 link_id = self.cleaned_data.get('link_id') |
40 # convert to lowercase for user comfort |
|
41 link_id = self.cleaned_data.get('link_id').lower() |
41 if not validate.isLinkIdFormatValid(link_id): |
42 if not validate.isLinkIdFormatValid(link_id): |
42 raise forms.ValidationError("This link ID is in wrong format.") |
43 raise forms.ValidationError("This link ID is in wrong format.") |
43 if logic.getFromFields(link_id=link_id): |
44 if logic.getFromFields(link_id=link_id): |
44 raise forms.ValidationError("This link ID is already in use.") |
45 raise forms.ValidationError("This link ID is already in use.") |
45 return link_id |
46 return link_id |
46 |
47 |
47 return wrapped |
48 return wrapped |
48 |
49 |
49 |
50 |
50 def clean_link_id(self): |
51 def clean_link_id(self): |
51 link_id = self.cleaned_data.get('link_id') |
52 # convert to lowercase for user comfort |
|
53 link_id = self.cleaned_data.get('link_id').lower() |
52 if not validate.isLinkIdFormatValid(link_id): |
54 if not validate.isLinkIdFormatValid(link_id): |
53 raise forms.ValidationError("This link ID is in wrong format.") |
55 raise forms.ValidationError("This link ID is in wrong format.") |
54 return link_id |
56 return link_id |
55 |
57 |
56 |
58 |