Latest Version: 0.9.6.2

PostalCode

US Postal codes (aka Zip Codes).

>>> PostalCode.to_python('55555')
'55555'
>>> PostalCode.to_python('55555-5555')
'55555-5555'
>>> PostalCode.to_python('5555')
Traceback (most recent call last):
    ...
Invalid: Please enter a zip code (5 digits)

Messages

badType:
The input must be a string (not a %(type)s: %(value)r)
empty:
Please enter a value
invalid:
Please enter a zip code (5 digits)
noneType:
The input must be a string (not None)

Attributes

a __singletonmethods__

('to_python', 'from_python')

a __unpackargs__

('regex',)

a accept_python

True

a compound

False

a not_empty

False

a regex

'^\\d\\d\\d\\d\\d(?:-\\d\\d\\d\\d)?$'

a regexOps

()

a repeating

False

a strip

True

Methods

f __call__(self, *args, **kw) ...

f __classinit__(cls, new_attrs) ...

f __classsourcerepr__(cls, source, binding=None) ...

f __init__(self, *args, **kw) ...

f __initargs__(self, new_attrs) ...

f __sourcerepr__(self, source, binding=None) ...

f validate_python(self, value, state) ...

See the source for more information.

Top