From 9c189f9083356a481bb69b757d82bee4b9f2523b Mon Sep 17 00:00:00 2001 From: Matt Wright Date: Fri, 17 Aug 2012 14:50:49 -0400 Subject: [PATCH] Clean up --- flask_security/utils.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/flask_security/utils.py b/flask_security/utils.py index 7041040..6e34534 100644 --- a/flask_security/utils.py +++ b/flask_security/utils.py @@ -66,10 +66,8 @@ def login_user(user, remember=True): user.login_count = user.login_count + 1 if user.login_count else 1 _datastore._save_model(user) - identity_changed.send(current_app._get_current_object(), identity=Identity(user.id)) - _logger.debug('User %s logged in' % user) return True @@ -77,10 +75,8 @@ def login_user(user, remember=True): def logout_user(): for key in ('identity.name', 'identity.auth_type'): session.pop(key, None) - identity_changed.send(current_app._get_current_object(), identity=AnonymousIdentity()) - _logout_user() @@ -157,10 +153,9 @@ def find_redirect(key): :param key: The session or application configuration key to search for """ - result = (get_url(session.pop(key.lower(), None)) or - get_url(current_app.config[key.upper()] or None) or '/') - - return result + rv = (get_url(session.pop(key.lower(), None)) or + get_url(current_app.config[key.upper()] or None) or '/') + return rv def get_config(app): @@ -238,10 +233,9 @@ def send_mail(subject, recipient, template, context=None): sender=_security.email_sender, recipients=[recipient]) - base = 'security/email' - msg.body = render_template('%s/%s.txt' % (base, template), **context) - msg.html = render_template('%s/%s.html' % (base, template), **context) - + ctx = ('security/email', template) + msg.body = render_template('%s/%s.txt' % ctx, **context) + msg.html = render_template('%s/%s.html' % ctx, **context) mail.send(msg)