|
@@ -72,8 +72,12 @@ class Varchar(DataField):
|
72
|
72
|
error = None
|
73
|
73
|
try:
|
74
|
74
|
value = str(value)
|
75
|
|
- except(ValueError, TypeError):
|
|
75
|
+ if len(value) > self.max_length:
|
|
76
|
+ raise ValueError
|
|
77
|
+ except TypeError:
|
76
|
78
|
error = TypeError("The value '%s' can't be a str" % value)
|
|
79
|
+ except ValueError:
|
|
80
|
+ error = ValueError("The value '%s' is longer than the maximum length of this field (%s)" % (value, self.max_length))
|
77
|
81
|
return value, error
|
78
|
82
|
|
79
|
83
|
##@brief Data field designed to handle date & time
|