diff --git a/VERSION b/VERSION index 874f6048..b751aea4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.4.1-alpha.2+timestamp.2013.01.21.14.12.24 +Version 2.4.1-alpha.2+timestamp.2013.01.21.16.42.00 diff --git a/gluon/validators.py b/gluon/validators.py index 276ed395..fc0600f1 100644 --- a/gluon/validators.py +++ b/gluon/validators.py @@ -328,12 +328,17 @@ class IS_JSON(Validator): self.error_message = error_message def __call__(self, value): + if value is None: + return None try: - simplejson.loads(value) - return (value, None) + return (simplejson.loads(value), None) except JSONErrors: - pass - return (value, translate(self.error_message)) + return (value, translate(self.error_message)) + + def formatter(self,value): + if value is None: + return None + return simplejson.dumps(value) class IS_IN_SET(Validator):