Open utgsolutions opened 6 years ago
I had same error on python3.5.2. The error is that the name of the setter of a property has to be same as that of the property. https://docs.python.org/3/library/functions.html#property If the name of the function '_set_password' is changed to 'password', then it will work. I don't know this change is compatible to python v2.x.
I get the same error on Python 2.7.15 but not on my dev laptop which is Python 2.7.11
[2019-02-07 21:12:55 +0000] [3621] [ERROR] Error handling request /user/signup Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 130, in handle self.handle_request(listener, req, client, addr) File "/usr/local/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 171, in handle_request respiter = self.wsgi(environ, resp.start_response) File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1836, in call return self.wsgi_app(environ, start_response) File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python2.7/site-packages/flask_debugtoolbar/init.py", line 125, in dispatch_request return view_func(*req.view_args) File "/home/tobyc/jlistener/app/views/user.py", line 30, in signup password=form.password.data File "
", line 4, in init File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/state.py", line 417, in _initialize_instance manager.dispatch.init_failure(self, args, kwargs) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 66, in exit compat.reraise(exc_type, exc_value, exc_tb) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/state.py", line 414, in _initialize_instance return manager.original_init( mixed[1:], **kwargs) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/ext/declarative/base.py", line 700, in _declarative_constructor setattr(self, k, kwargs[k]) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/ext/hybrid.py", line 873, in set raise AttributeError("can't set attribute") AttributeError: can't set attribute
I changed the function '_set_password' to 'password', it model.py and it has resolved the problem.
There is still an issue directing after signup where it goes to localhost/user/XXX but that could be an unrelated issue with config somewhere.
I get the error: AttributeError: can't set attribute
More Details: File "/Users/xxxxx/Projects/flask-boilerplate/app/views/user.py", line 27, in signup password=form.password.data, File "", line 4, in init
Python version 3.6.2