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

Change flash() in StormpathError to take in unicode string rather than dict #69

Closed viksit closed 8 years ago

viksit commented 8 years ago

From stormpath version 2.2.0 and later, the flash function should be simply passing err.message in, rather than think it's a dictionary object.

This is the stack trace without the fix,

Traceback (most recent call last):
  File "/usr/conda_env/lib/python2.7/site-packages/flask/app.py", line 2000, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/conda_env/lib/python2.7/site-packages/flask/app.py", line 1991, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/conda_env/lib/python2.7/site-packages/flask/app.py", line 1567, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/conda_env/lib/python2.7/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/conda_env/lib/python2.7/site-packages/flask/app.py", line 1641, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/conda_env/lib/python2.7/site-packages/flask/app.py", line 1544, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/conda_env/lib/python2.7/site-packages/flask/app.py", line 1639, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/conda_env/lib/python2.7/site-packages/flask/app.py", line 1625, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/conda_env/lib/python2.7/site-packages/flask_stormpath/views.py", line 98, in register
    flash(err.message.get('message'))
AttributeError: 'unicode' object has no attribute 'get'

Versions

Flask-Stormpath==0.4.5
stormpath==2.4.0
Flask=0.10.1
viksit commented 8 years ago

@rdegges: Could you please review and update? Thanks!

alexguedes commented 8 years ago

+1

rdegges commented 8 years ago

Thank you =) Been multi-tasking here, sorry for the delay!! =/