Permalink
Browse files

Compatibility with older versions of simplejson.

  • Loading branch information...
ralphbean committed Apr 16, 2012
1 parent a885726 commit 64d16f234f8aec46a23d4a92e9da53e5e8c77a87
Showing with 3 additions and 4 deletions.
  1. +3 −4 tw2/core/js.py
@@ -44,10 +44,6 @@ class TWEncoder(simplejson.encoder.JSONEncoder):
"""
def __init__(self, *args, **kw):
# This is required to get encoding of _js_call to work
kw['namedtuple_as_object'] = False
# This makes encoded objects be prettily formatted. It is very nice for
# debugging and should be made configurable at some point.
# TODO -- make json encoding pretty-printing configurable
@@ -56,6 +52,9 @@ def __init__(self, *args, **kw):
self.pass_through = (_js_call, js_callback, js_symbol, js_function)
super(TWEncoder, self).__init__(*args, **kw)
# This is required to get encoding of _js_call to work
self.namedtuple_as_object = False
def default(self, obj):
if isinstance(obj, self.pass_through):
return self.mark_for_escape(obj)

0 comments on commit 64d16f2

Please sign in to comment.