Skip to content

Instantly share code, notes, and snippets.

@mycahp
Created September 10, 2014 00:23
Show Gist options
  • Save mycahp/f3052398e8cf06378ba4 to your computer and use it in GitHub Desktop.
Save mycahp/f3052398e8cf06378ba4 to your computer and use it in GitHub Desktop.
def check_login(self):
userSearch = session.query(UsersTable).filter_by(username=self.username).count()
if userSearch >= 1:
password_check = self.check_password(self.stored_password, self.password)
if password_check is True:
login = 1
return login
else:
login = 0
return login
else:
login = 0 # No matching usernmaes
return login
@mycahp
Copy link
Author

mycahp commented Sep 10, 2014

def check_password(self, stored_password, password):
    return check_password_hash(self.stored_password, self.password)

@mycahp
Copy link
Author

mycahp commented Sep 10, 2014

TypeError
TypeError: count() takes exactly 1 argument (2 given)

Traceback (most recent call last)
File "/var/www/flask-game/env/lib/python2.7/site-packages/flask/app.py", line 1836, in call
return self.wsgi_app(environ, start_response)
File "/var/www/flask-game/env/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/var/www/flask-game/env/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/var/www/flask-game/env/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/var/www/flask-game/env/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/var/www/flask-game/env/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/var/www/flask-game/env/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/var/www/flask-game/env/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "/var/www/flask-game/app/routes.py", line 48, in account_login
if user.check_login() == 1:
File "/var/www/flask-game/app/user.py", line 60, in check_login
password_check = self.check_password(self.stored_password, self.password)
File "/var/www/flask-game/app/user.py", line 54, in check_password
return check_password_hash(self.stored_password, self.password)
File "/var/www/flask-game/env/lib/python2.7/site-packages/werkzeug/security.py", line 229, in check_password_hash
if pwhash.count('$') < 2:
TypeError: count() takes exactly 1 argument (2 given)
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

dump() shows all variables in the frame
dump(obj) dumps all that's known about the object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment