fixed LazyCrypt, thanks Denes

This commit is contained in:
mdipierro
2015-10-07 12:57:20 -05:00
parent 0fa0dbaeea
commit 1387b26606

View File

@@ -2847,9 +2847,11 @@ class CRYPT(object):
self.salt = salt
def __call__(self, value):
value = value and value[:self.max_length]
if len(value) < self.min_length:
v = v and str(v)[:self.max_length]
if not v or len(v) < self.min_length:
return ('', translate(self.error_message))
if isinstance(value, LazyCrypt):
return (value, None)
return (LazyCrypt(self, value), None)
# entropy calculator for IS_STRONG