Browse Source

python-modernize automated changes: fix_next

pull/735/head
Thomas Waldmann 12 years ago
parent
commit
dcd052366b
  1. 3
      flask/helpers.py
  2. 2
      flask/sessions.py
  3. 3
      flask/testsuite/helpers.py

3
flask/helpers.py

@ -26,6 +26,7 @@ from functools import update_wrapper
from werkzeug.datastructures import Headers from werkzeug.datastructures import Headers
from werkzeug.exceptions import NotFound from werkzeug.exceptions import NotFound
import six
# this was moved in 0.7 # this was moved in 0.7
try: try:
@ -128,7 +129,7 @@ def stream_with_context(generator_or_function):
# pushed. This item is discarded. Then when the iteration continues the # pushed. This item is discarded. Then when the iteration continues the
# real generator is executed. # real generator is executed.
wrapped_g = generator() wrapped_g = generator()
wrapped_g.next() six.advance_iterator(wrapped_g)
return wrapped_g return wrapped_g

2
flask/sessions.py

@ -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 = obj.iteritems().next() the_key, the_value = six.advance_iterator(obj.iteritems())
if the_key == ' t': if the_key == ' t':
return tuple(the_value) return tuple(the_value)
elif the_key == ' u': elif the_key == ' u':

3
flask/testsuite/helpers.py

@ -18,6 +18,7 @@ from logging import StreamHandler
from StringIO import StringIO from StringIO import StringIO
from flask.testsuite import FlaskTestCase, catch_warnings, catch_stderr from flask.testsuite import FlaskTestCase, catch_warnings, catch_stderr
from werkzeug.http import parse_cache_control_header, parse_options_header from werkzeug.http import parse_cache_control_header, parse_options_header
import six
def has_encoding(name): def has_encoding(name):
@ -507,7 +508,7 @@ class StreamingTestCase(FlaskTestCase):
def close(self): def close(self):
called.append(42) called.append(42)
def next(self): def next(self):
return self._gen.next() return six.advance_iterator(self._gen)
@app.route('/') @app.route('/')
def index(): def index():
def generate(): def generate():

Loading…
Cancel
Save