Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1194 from akatsoulas/1155623-error-msg
Browse files Browse the repository at this point in the history
[fix bug 1155623] Change error message in skills validation.
  • Loading branch information
akatsoulas committed Jun 8, 2015
2 parents 70b9efb + 2bdd9f9 commit ead2afe
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions mozillians/phonebook/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def clean_username(self):
# This causes a potential race condition however the worst that can
# happen is bad UI.
if (User.objects.filter(username=username).
exclude(pk=self.instance.id).exists()):
exclude(pk=self.instance.id).exists()):
raise forms.ValidationError(_(u'This username is in use. Please try'
u' another.'))

Expand Down Expand Up @@ -219,8 +219,7 @@ def clean_skills(self):
if not re.match(r'^[a-zA-Z0-9 +.:,-]*$', self.cleaned_data['skills']):
# Commas cannot be included in skill names because we use them to
# separate names in a list
raise forms.ValidationError(_(u'Skills can only contain '
u'alphanumeric characters '
raise forms.ValidationError(_(u'Skills can only contain latin characters '
u'and +.:-.'))
skills = self.cleaned_data['skills']
return filter(lambda x: x,
Expand All @@ -232,7 +231,7 @@ def clean(self):
if self.cleaned_data.get('lat') is not None and self.cleaned_data.get('lng') is not None:
# We only want to call reverse_geocode if some location data changed.
if ('lat' in self.changed_data or 'lng' in self.changed_data or
'saveregion' in self.changed_data or 'savecity' in self.changed_data):
'saveregion' in self.changed_data or 'savecity' in self.changed_data):
self.instance.lat = self.cleaned_data['lat']
self.instance.lng = self.cleaned_data['lng']
self.instance.reverse_geocode()
Expand Down Expand Up @@ -289,8 +288,7 @@ class EmailForm(happyforms.Form):

def clean_email(self):
email = self.cleaned_data['email']
if (User.objects
.exclude(pk=self.initial['user_id']).filter(email=email).exists()):
if (User.objects.exclude(pk=self.initial['user_id']).filter(email=email).exists()):
raise forms.ValidationError(_(u'Email is currently associated with another user.'))
return email

Expand Down

0 comments on commit ead2afe

Please sign in to comment.