From a84ac2f61e4ec6e81bcce926618eb01bcccf4eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Piboub=C3=A8s?= Date: Sat, 5 Sep 2015 16:36:12 +0200 Subject: [PATCH] Stop IOLoop when callback page reached with GUI browser --- rtv/oauth.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rtv/oauth.py b/rtv/oauth.py index 1dfcc67..6a51ada 100644 --- a/rtv/oauth.py +++ b/rtv/oauth.py @@ -28,6 +28,9 @@ class HomeHandler(web.RequestHandler): class AuthHandler(web.RequestHandler): + def initialize(self): + self.compact = os.environ.get('BROWSER') in ['w3m', 'links', 'elinks', 'lynx'] + def get(self): global oauth_state global oauth_code @@ -39,6 +42,10 @@ class AuthHandler(web.RequestHandler): self.render('auth.html', state=oauth_state, code=oauth_code, error=oauth_error) + # Stop IOLoop if using BackgroundBrowser (or GUI browser) + if not self.compact: + ioloop.IOLoop.current().stop() + class OAuthTool(object): def __init__(self, reddit, stdscr=None, loader=None,