forked from orbit-oss/flask
Merge pull request #1079 from smarkets/master
Get rid of _tag->closure->_tag reference cycle
This commit is contained in:
commit
7cfe833a50
1 changed files with 26 additions and 24 deletions
|
|
@ -52,12 +52,6 @@ class SessionMixin(object):
|
||||||
modified = True
|
modified = True
|
||||||
|
|
||||||
|
|
||||||
class TaggedJSONSerializer(object):
|
|
||||||
"""A customized JSON serializer that supports a few extra types that
|
|
||||||
we take for granted when serializing (tuples, markup objects, datetime).
|
|
||||||
"""
|
|
||||||
|
|
||||||
def dumps(self, value):
|
|
||||||
def _tag(value):
|
def _tag(value):
|
||||||
if isinstance(value, tuple):
|
if isinstance(value, tuple):
|
||||||
return {' t': [_tag(x) for x in value]}
|
return {' t': [_tag(x) for x in value]}
|
||||||
|
|
@ -82,6 +76,14 @@ class TaggedJSONSerializer(object):
|
||||||
u'which can only store unicode strings. Consider '
|
u'which can only store unicode strings. Consider '
|
||||||
u'base64 encoding your string (String was %r)' % value)
|
u'base64 encoding your string (String was %r)' % value)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
class TaggedJSONSerializer(object):
|
||||||
|
"""A customized JSON serializer that supports a few extra types that
|
||||||
|
we take for granted when serializing (tuples, markup objects, datetime).
|
||||||
|
"""
|
||||||
|
|
||||||
|
def dumps(self, value):
|
||||||
return json.dumps(_tag(value), separators=(',', ':'))
|
return json.dumps(_tag(value), separators=(',', ':'))
|
||||||
|
|
||||||
def loads(self, value):
|
def loads(self, value):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue