|
From: <sub...@co...> - 2006-05-26 16:02:44
|
Author: ianb
Date: 2006-05-26 10:02:37 -0600 (Fri, 26 May 2006)
New Revision: 1794
Modified:
FormEncode/trunk/formencode/validators.py
Log:
Patch for CC validation, fixing case where ccCode starts with 0, from Dennis Muhlestein
Modified: FormEncode/trunk/formencode/validators.py
===================================================================
--- FormEncode/trunk/formencode/validators.py 2006-05-23 12:13:58 UTC (rev 1793)
+++ FormEncode/trunk/formencode/validators.py 2006-05-26 16:02:37 UTC (rev 1794)
@@ -2358,13 +2358,13 @@
ccCode = str(field_dict[self.cc_code_field]).strip()
try:
- ccCode = int(ccCode)
+ int(ccCode)
except ValueError:
return {self.cc_code_field: self.message('notANumber', state)}
length = self._cardInfo[ccType]
validLength = False
- if len(str(ccCode)) == length:
+ if len(ccCode) == length:
validLength = True
if not validLength:
return {self.cc_code_field: self.message('badLength', state)}
|