stormpath / stormpath-flask

Build simple, secure web applications with Stormpath and Flask!
http://flask-stormpath.readthedocs.org/en/latest/
Other
155 stars 31 forks source link

Add explicit dependency on flask_wtf 0.13.1. #92

Open finbarrtimbers opened 7 years ago

finbarrtimbers commented 7 years ago

Description

flask_wtf 0.14 introduces breaking changes. I believe this is because flask_wtf doesn't use SecureForm anymore. See:

https://flask-wtf.readthedocs.io/en/stable/changelog.html#version-0-14

Steps to replicate

  1. Update flask_wtf with pip install --upgrade flask_wtf.
  2. Try to access the default registration page for stormpath-flask. It will not load.

I'll submit a PR.

dappiu commented 7 years ago

I confirm that using Flask-WTF==0.14 an error comes out when trying to access the /register view, but everything works fine with Flask-WTF==0.13.1. This is the error I get:

  File "/home/dappiu/.virtualenvs/wineplan/lib/python3.6/site-packages/flask_stormpath/views.py", line 39, in register
    form = RegistrationForm(config=current_app.config)
  File "/home/dappiu/.virtualenvs/wineplan/lib/python3.6/site-packages/wtforms/form.py", line 212, in __call__
    return type.__call__(cls, *args, **kwargs)
  File "/home/dappiu/.virtualenvs/wineplan/lib/python3.6/site-packages/flask_stormpath/forms.py", line 40, in __init__
    **kwargs)
  File "/home/dappiu/.virtualenvs/wineplan/lib/python3.6/site-packages/flask_wtf/form.py", line 158, in __init__
    super(Form, self).__init__(*args, **kwargs)
TypeError: __init__() takes from 1 to 2 positional arguments but 7 were given
chrisutpg commented 7 years ago

I can confirm this also. Drove me nuts before seeing this issue.

jcass77 commented 7 years ago

This was fixed with #90 when we switched from using Form to FlaskForm.

Have you tried using the 'develop' branch to see if that works for you?

@rdegges, it might be time to consider cutting a new release as lots of people will be forced to upgrade to Flask-WTF>=0.14 to satisfy dependencies in other Flask extensions that they may be using.

jcass77 commented 7 years ago

There may be two separate issues here: the TypeError: __init__() takes from 1 to 2 positional arguments but 7 were given that @dappiu reported should not be a problem in the 'develop' branch as I said.

But I think that @finbarrtimbers was referring to another issue related to csrf_token on the /register page:

Traceback (most recent call last):
  File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/flask/app.py", line 1994, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
    response = self.handle_exception(e)
  File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/Flask_Stormpath-0.4.8-py2.7.egg/flask_stormpath/views.py", line 58, in register
    account = User.create(**data)
TypeError: create() got an unexpected keyword argument 'csrf_token'
finbarrtimbers commented 7 years ago

Nope- I was experiencing the TypeError problem. I couldn't load the registration page as a result, so I didn't get to the point of trying to create a user. On Tue, Feb 7, 2017 at 08:12 John Cass notifications@github.com wrote:

There may be two separate issues here: the TypeError: init() takes from 1 to 2 positional arguments but 7 were given that @dappiu https://github.com/dappiu reported should not be a problem in the 'develop' branch as I said.

But I think that @finbarrtimbers https://github.com/finbarrtimbers was referring to another issue related to csrf_token on the /register page:

Traceback (most recent call last): File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/flask/app.py", line 1994, in call return self.wsgi_app(environ, start_response) File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app response = self.handle_exception(e) File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception reraise(exc_type, exc_value, tb) File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request return self.view_functionsrule.endpoint File "/Users/jcass/PycharmProjects/barrus/barrus-otc/venv/lib/python2.7/site-packages/Flask_Stormpath-0.4.8-py2.7.egg/flask_stormpath/views.py", line 58, in register account = User.create(**data) TypeError: create() got an unexpected keyword argument 'csrf_token'

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/stormpath/stormpath-flask/issues/92#issuecomment-278028897, or mute the thread https://github.com/notifications/unsubscribe-auth/ADDfRThWI7nX3--6uGahYchow5GWtCRaks5raIn7gaJpZM4LqR1N .

jcass77 commented 7 years ago

Ah I see. #94 seems to fixe the remaining issues with the /register page.

finbarrtimbers commented 7 years ago

Okay, great.

rdegges commented 7 years ago

Sorry for the delay on this everyone. We've been working on a new release of this library internally which is revamping the configuration to support all the new Stormpath functionality. It's pretty close to completion, so I was hoping to fix all this stuff with the new major release in a couple weeks.

jcass77 commented 7 years ago

@rdegges, do you think we can configure the repository to use 'develop' as the default branch instead of 'master'?

Apart from allowing us to close issues automatically via commit messages as soon as we merge, it will also reduce the likelihood of someone accidentally creating a pull request against the 'master' branch.

All of the issues reported here should now be resolved...