Commit c7a45b04 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update directsvc.JSONEncoder to add a constructor.

parent 30d0e4d9
......@@ -26,6 +26,38 @@ class JSONEncoder(json.JSONEncoder):
- time
"""
def __init__(self,
skipkeys=False,
ensure_ascii=True,
check_circular=True,
allow_nan=True,
sort_keys=False,
indent=None,
separators=None,
encoding='utf-8',
default=None,
use_decimal=False):
"""
Note:
* Copy from the base class gluon.contrib.simplejson
* the controller plugin_dbui.dbui_conf is crashing if the
constructor is not defined (not understood)
"""
self.skipkeys = skipkeys
self.ensure_ascii = ensure_ascii
self.check_circular = check_circular
self.allow_nan = allow_nan
self.sort_keys = sort_keys
self.use_decimal = use_decimal
if isinstance(indent, (int, long)):
indent = ' ' * indent
self.indent = indent
if separators is not None:
self.item_separator, self.key_separator = separators
if default is not None:
self.default = default
self.encoding = encoding
def default(self, obj):
if isinstance(obj, (datetime.date,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment