forked from orbit-oss/flask
Fix .iteritems() access in flask.sessions
This commit is contained in:
parent
d395d3684a
commit
135c53a5f2
1 changed files with 5 additions and 5 deletions
|
|
@ -15,9 +15,9 @@ from datetime import datetime
|
||||||
from werkzeug.http import http_date, parse_date
|
from werkzeug.http import http_date, parse_date
|
||||||
from werkzeug.datastructures import CallbackDict
|
from werkzeug.datastructures import CallbackDict
|
||||||
from . import Markup, json
|
from . import Markup, json
|
||||||
|
from ._compat import iteritems, text_type
|
||||||
|
|
||||||
from itsdangerous import URLSafeTimedSerializer, BadSignature
|
from itsdangerous import URLSafeTimedSerializer, BadSignature
|
||||||
import six
|
|
||||||
|
|
||||||
|
|
||||||
def total_seconds(td):
|
def total_seconds(td):
|
||||||
|
|
@ -63,16 +63,16 @@ class TaggedJSONSerializer(object):
|
||||||
elif isinstance(value, uuid.UUID):
|
elif isinstance(value, uuid.UUID):
|
||||||
return {' u': value.hex}
|
return {' u': value.hex}
|
||||||
elif callable(getattr(value, '__html__', None)):
|
elif callable(getattr(value, '__html__', None)):
|
||||||
return {' m': six.text_type(value.__html__())}
|
return {' m': text_type(value.__html__())}
|
||||||
elif isinstance(value, list):
|
elif isinstance(value, list):
|
||||||
return [_tag(x) for x in value]
|
return [_tag(x) for x in value]
|
||||||
elif isinstance(value, datetime):
|
elif isinstance(value, datetime):
|
||||||
return {' d': http_date(value)}
|
return {' d': http_date(value)}
|
||||||
elif isinstance(value, dict):
|
elif isinstance(value, dict):
|
||||||
return dict((k, _tag(v)) for k, v in six.iteritems(value))
|
return dict((k, _tag(v)) for k, v in iteritems(value))
|
||||||
elif isinstance(value, str):
|
elif isinstance(value, str):
|
||||||
try:
|
try:
|
||||||
return six.text_type(value)
|
return text_type(value)
|
||||||
except UnicodeError:
|
except UnicodeError:
|
||||||
raise UnexpectedUnicodeError(u'A byte string with '
|
raise UnexpectedUnicodeError(u'A byte string with '
|
||||||
u'non-ASCII data was passed to the session system '
|
u'non-ASCII data was passed to the session system '
|
||||||
|
|
@ -85,7 +85,7 @@ class TaggedJSONSerializer(object):
|
||||||
def object_hook(obj):
|
def object_hook(obj):
|
||||||
if len(obj) != 1:
|
if len(obj) != 1:
|
||||||
return obj
|
return obj
|
||||||
the_key, the_value = six.advance_iterator(obj.iteritems())
|
the_key, the_value = next(iteritems(obj))
|
||||||
if the_key == ' t':
|
if the_key == ' t':
|
||||||
return tuple(the_value)
|
return tuple(the_value)
|
||||||
elif the_key == ' u':
|
elif the_key == ' u':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue