The CreditCardSecurityCode class is accessible via the formencode.validators module.
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
See the source for more information.