Flask-edits: AttributeError: 'TokenStream' object has no attribute 'next'
Question: I am trying to test the flask-edits package
(<https://github.com/nathancahill/Flask-Edits>)

Can anyone help with this error: AttributeError: 'TokenStream' object has no
attribute 'next'

    
    
    @app.route('/')
        def hello_world():
            return render_template('test.html')
    
        if __name__ == '__main__':
            app.run(debug=True)
    

The template:

    
    
    <!DOCTYPE html>
    <html>
    <head>
        <title>Haldane</title>
    </head>
    <body>
    
    <p>Test</p>
    
    {% editable 'Section name' %}
        Python is a programming language that lets you work quickly and integrate systems more effectively.
    {% endeditable %}
    
    </body>
    </html>
    

The error occurs here:

    
    
    """Jinja extensions to mark sections as editable
    """
    import hashlib
    from collections import OrderedDict
    from jinja2.nodes import Output, Template, TemplateData
    from jinja2.ext import Extension
    
    class EditableExtension(Extension):
        tags = set(['editable'])
    
        def parse(self, parser):
            _db = self.environment.edits
    
            # Skip begining node
            parser.stream.next()
    

The error:

    
    
    File "/anaconda/lib/python3.5/site-packages/flask_edits/editable.py", line 18, in parse
    parser.stream.next()
    AttributeError: 'TokenStream' object has no attribute 'next'
    

Gist including the code:
<https://gist.github.com/archienorman11/98993d66fc30283ba113f8a4f2b39669>


Answer: Assuming Flask-Edits wants to support Python 3, this is a bug in Flask-Edits.
It should use the builtin
[`next`](https://docs.python.org/3/library/functions.html#next) function to
advance iterators: `next(parser.stream)`. The method on the iterator changed
from `next` to `__next__` between Python 2 and 3. The builtin function works
for both.

