wpint: More input length validation of addresses
This commit is contained in:
parent
f8e81db8cb
commit
06d990510c
|
@ -114,10 +114,16 @@ class WarenpostInt(object):
|
||||||
sender and recipient."""
|
sender and recipient."""
|
||||||
def __init__(self, name, addr_lines, city, country_code, postal_code='', state=None,
|
def __init__(self, name, addr_lines, city, country_code, postal_code='', state=None,
|
||||||
phone=None, fax=None, email=None):
|
phone=None, fax=None, email=None):
|
||||||
if len(addr_lines) > 3:
|
|
||||||
raise ValueError('Maximum number of 3 Address Lines supported')
|
|
||||||
if len(name) > 30:
|
if len(name) > 30:
|
||||||
raise ValueError('Maximum length of name is 30 chars')
|
raise ValueError('Maximum length of name is 30 chars')
|
||||||
|
if len(addr_lines) > 3:
|
||||||
|
raise ValueError('Maximum number of 3 Address Lines supported')
|
||||||
|
if len(city) > 30:
|
||||||
|
raise ValueError('Maximum length of city is 30 chars')
|
||||||
|
if len(country_code) != 2:
|
||||||
|
raise ValueError('Country must be 2-digit ISO-3166-1 code')
|
||||||
|
if state and len(state) > 20:
|
||||||
|
raise ValueError('Maximum length of state is 20 chars')
|
||||||
if phone and len(phone) > 15:
|
if phone and len(phone) > 15:
|
||||||
raise ValueError('Maximum length of phone number is 15 chars')
|
raise ValueError('Maximum length of phone number is 15 chars')
|
||||||
if fax and len(fax) > 15:
|
if fax and len(fax) > 15:
|
||||||
|
|
Loading…
Reference in New Issue