Browse Source

python-modernize automated changes: fix_dict

pull/735/head
Thomas Waldmann 12 years ago
parent
commit
0f8c47c988
  1. 3
      flask/sessions.py
  2. 5
      flask/templating.py

3
flask/sessions.py

@ -17,6 +17,7 @@ from werkzeug.datastructures import CallbackDict
from . import Markup, json from . import Markup, json
from itsdangerous import URLSafeTimedSerializer, BadSignature from itsdangerous import URLSafeTimedSerializer, BadSignature
import six
def total_seconds(td): def total_seconds(td):
@ -68,7 +69,7 @@ class TaggedJSONSerializer(object):
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 value.iteritems()) return dict((k, _tag(v)) for k, v in six.iteritems(value))
elif isinstance(value, str): elif isinstance(value, str):
try: try:
return unicode(value) return unicode(value)

5
flask/templating.py

@ -15,6 +15,7 @@ from jinja2 import BaseLoader, Environment as BaseEnvironment, \
from .globals import _request_ctx_stack, _app_ctx_stack from .globals import _request_ctx_stack, _app_ctx_stack
from .signals import template_rendered from .signals import template_rendered
from .module import blueprint_is_module from .module import blueprint_is_module
import six
def _default_template_ctx_processor(): def _default_template_ctx_processor():
@ -79,7 +80,7 @@ class DispatchingJinjaLoader(BaseLoader):
except (ValueError, KeyError): except (ValueError, KeyError):
pass pass
for blueprint in self.app.blueprints.itervalues(): for blueprint in six.itervalues(self.app.blueprints):
if blueprint_is_module(blueprint): if blueprint_is_module(blueprint):
continue continue
loader = blueprint.jinja_loader loader = blueprint.jinja_loader
@ -92,7 +93,7 @@ class DispatchingJinjaLoader(BaseLoader):
if loader is not None: if loader is not None:
result.update(loader.list_templates()) result.update(loader.list_templates())
for name, blueprint in self.app.blueprints.iteritems(): for name, blueprint in six.iteritems(self.app.blueprints):
loader = blueprint.jinja_loader loader = blueprint.jinja_loader
if loader is not None: if loader is not None:
for template in loader.list_templates(): for template in loader.list_templates():

Loading…
Cancel
Save