Browse Source

wpint: More input length validation of addresses

master
Harald Welte 5 months ago
parent
commit
06d990510c
  1. 10
      inema/wpint.py

10
inema/wpint.py

@ -114,10 +114,16 @@ class WarenpostInt(object):
sender and recipient."""
def __init__(self, name, addr_lines, city, country_code, postal_code='', state=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:
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:
raise ValueError('Maximum length of phone number is 15 chars')
if fax and len(fax) > 15:

Loading…
Cancel
Save