From 7e4fc94601d4f3545b1d221a8152842441183961 Mon Sep 17 00:00:00 2001 From: Alex Eftimie Date: Wed, 19 Nov 2014 14:11:58 +0200 Subject: [PATCH] Fail silently for get_user(None) get_user(identifier) checks if the identifier is a number by trying to convert it to int. This works for strings, but in a particular case, when identifier is None, it fails. Checking for both TypeError and ValueError fixes it. --- flask_security/datastore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask_security/datastore.py b/flask_security/datastore.py index aca5d50c..3d009ad9 100644 --- a/flask_security/datastore.py +++ b/flask_security/datastore.py @@ -195,7 +195,7 @@ def get_user(self, identifier): def _is_numeric(self, value): try: int(value) - except ValueError: + except (TypeError, ValueError): return False return True