remove simplejson

This commit is contained in:
Leonel Câmara
2016-05-11 00:47:23 +01:00
parent 713fe8e2bc
commit a9ee9a6b58
34 changed files with 56 additions and 1785 deletions
+4 -9
View File
@@ -16,6 +16,7 @@ import re
import datetime
import time
import cgi
import json
import urllib
import struct
import decimal
@@ -28,12 +29,6 @@ regex_isint = re.compile('^[+-]?\d+$')
JSONErrors = (NameError, TypeError, ValueError, AttributeError,
KeyError)
try:
import json as simplejson
except ImportError:
from gluon.contrib import simplejson
from gluon.contrib.simplejson.decoder import JSONDecodeError
JSONErrors += (JSONDecodeError,)
__all__ = [
'ANY_OF',
@@ -376,10 +371,10 @@ class IS_JSON(Validator):
def __call__(self, value):
try:
if self.native_json:
simplejson.loads(value) # raises error in case of malformed json
json.loads(value) # raises error in case of malformed json
return (value, None) # the serialized value is not passed
else:
return (simplejson.loads(value), None)
return (json.loads(value), None)
except JSONErrors:
return (value, translate(self.error_message))
@@ -389,7 +384,7 @@ class IS_JSON(Validator):
if self.native_json:
return value
else:
return simplejson.dumps(value)
return json.dumps(value)
class IS_IN_SET(Validator):