mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
Support 202009 (#841)
* Add EmailMultiAlternatives import * Add strip_tags import * Add settings imports and new email test * Add email increment to ixf and tests * IX-F Importer: suggested update when it should be add + remove #832 * Take email increment out of if-else * Add max and min speed settings * Change validation check for models * new speed validation * Add basic user command * Add pdb cleanup users tool * Add pretty printing for speed * Add users as a subparser * add translation override to signals * Add parser as parent of subparser * refactor and change test * Move override to cover single variable * Add tooltip option for individual checkboxes * address 'fix me' issue with field_help helper func * Add zipcode validator and black format * Make website required input but zipcode dependent on country * Add net POC requirement to Netixlan serializer * Website is now blank=False ie required in all forms * refine error message * Require email is not blank and add test * Change error message * add website and zipcode test, edit zipcode error message * change placement of tooltip * add question mark * Add comment * Add runtime error logging for ixp member import * add uncaught error test * delete two unused methods * Rename test file and add different tests * Add missing email imports (reproduces changes in hot_fix_gh_831) * add resend methods * Add missing email imports (reproduces changes in hot_fix_gh_831) * Add pytest-mock to pipfile * Add resend email mechanism * Add email resending * remove failing assertion * fix for ticket_aged_proposals * Wrap resending emails in conditional for commit * Add resend email tests * fix mail_Debug bug * Figure out production mailing and resending settings * Add stale info field * default IXF_RESEND_FAILED_EMAILS to False fix issue with sent being set even if email was not sent fix issue with output stating resending of emails even if it wasnt * IX-F Preview - shows the consolidated delete operation when it shouldn't (#824) * black format (v 19.10) * black formatting * black formatting * pipfile relock * make changes from #825 play nice with changes from #833 * black to pipenv dev packages Co-authored-by: Elliot Frank <elliot@20c.com> Co-authored-by: Stefan Pratter <stefan@20c.com>
This commit is contained in:
@@ -41,6 +41,30 @@ def validate_phonenumber(phonenumber, country=None):
|
||||
raise ValidationError(_("Not a valid phone number (E.164)"))
|
||||
|
||||
|
||||
def validate_zipcode(zipcode, country):
|
||||
"""
|
||||
Validate a zipcode for a country. If a country has zipcodes, a zipcode
|
||||
is required. If a country does not have zipcodes, it's not required.
|
||||
|
||||
|
||||
Arguments:
|
||||
- zipcode (can be Str or None at this point)
|
||||
- country (two-letter country-code provided in data)
|
||||
Raises:
|
||||
- ValidationError if Zipcode is missing from a country WITH
|
||||
zipcodes
|
||||
Returns:
|
||||
- str: zipcode
|
||||
"""
|
||||
if country in settings.NON_ZIPCODE_COUNTRIES:
|
||||
return ""
|
||||
else:
|
||||
if (zipcode is None) or (zipcode == ""):
|
||||
raise ValidationError(_("Input required"))
|
||||
else:
|
||||
return zipcode
|
||||
|
||||
|
||||
def validate_prefix(prefix):
|
||||
"""
|
||||
validate ip prefix
|
||||
|
Reference in New Issue
Block a user