CreditCardExpires

Checks that credit card expiration date is valid relative to the current date.

You pass in the name of the field that has the credit card expiration month and the field with the credit card expiration year.

>>> ed = CreditCardExpires()
>>> ed.to_python({'ccExpiresMonth': '11', 'ccExpiresYear': '2250'})
{'ccExpiresYear': '2250', 'ccExpiresMonth': '11'}
>>> ed.to_python({'ccExpiresMonth': '10', 'ccExpiresYear': '2005'})
Traceback (most recent call last):
    ...
Invalid: ccExpiresMonth: Invalid Expiration Date<br>
ccExpiresYear: Invalid Expiration Date

Messages

badType:
The input must be a string (not a %(type)s: %(value)r)
empty:
Please enter a value
invalidNumber:
Invalid Expiration Date
noneType:
The input must be a string (not None)
notANumber:
Please enter numbers only for month and year

Attributes

a gettextargs

{}

a strip

False

a accept_python

True

a cc_expires_year_field

'ccExpiresYear'

a validate_partial_python

None

a __singletonmethods__

('to_python', 'from_python', 'message', 'all_messages', 'subvalidators')

a declarative_count

49

a use_builtins_gettext

True

a __unpackargs__

('cc_expires_month_field', 'cc_expires_year_field')

a validate_partial_form

True

a cc_expires_month_field

'ccExpiresMonth'

a compound

False

a not_empty

False

a datetime_module

None

a validate_partial_other

None

a __mutableattributes__

()

a repeating

False

Methods

f __initargs__(self, new_attrs) ...

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

f __classinit__(cls, new_attrs) ...

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

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

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

f validate_partial(self, field_dict, state) ...

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

See the source for more information.