Example #1
0
File: forms.py Project: zalun/pto
 def clean_country(self):  # pragma: no cover
     # this method doesn't do much since we're using a ChoiceField
     value = self.cleaned_data['country']
     if value in COUNTRY_ALIASES.values():
         pass
     elif value in COUNTRY_ALIASES:
         value = COUNTRY_ALIASES.get(value)
     else:
         # search case-insensitively
         for alias in COUNTRY_ALIASES:
             if alias.lower() == value.lower():
                 value = COUNTRY_ALIASES[alias]
                 break
     return value
Example #2
0
File: forms.py Project: mozilla/pto
 def clean_country(self):  # pragma: no cover
     # this method doesn't do much since we're using a ChoiceField
     value = self.cleaned_data['country']
     if value in COUNTRY_ALIASES.values():
         pass
     elif value in COUNTRY_ALIASES:
         value = COUNTRY_ALIASES.get(value)
     else:
         # search case-insensitively
         for alias in COUNTRY_ALIASES:
             if alias.lower() == value.lower():
                 value = COUNTRY_ALIASES[alias]
                 break
     return value