CreditCardSecurityCode

Checks that credit card security code has the correct number of digits for the given credit card type.

You pass in the name of the field that has the credit card type and the field with the credit card security code.

>>> code = CreditCardSecurityCode()
>>> code.to_python({'ccType': 'visa', 'ccCode': '111'})
{'ccType': 'visa', 'ccCode': '111'}
>>> code.to_python({'ccType': 'visa', 'ccCode': '1111'})
Traceback (most recent call last):
    ...
Invalid: ccCode: Invalid credit card security code length

Messages

badLength:
Invalid credit card security code length
badType:
The input must be a string (not a %(type)s: %(value)r)
empty:
Please enter a value
noneType:
The input must be a string (not None)
notANumber:
Please enter numbers only for credit card security code

Attributes

a gettextargs

{}

a cc_type_field

'ccType'

a strip

False

a accept_python

True

a validate_partial_python

None

a __singletonmethods__

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

a cc_code_field

'ccCode'

a declarative_count

50

a use_builtins_gettext

True

a __unpackargs__

('cc_type_field', 'cc_code_field')

a validate_partial_form

True

a compound

False

a not_empty

False

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.