Stop IOLoop when callback page reached with GUI browser

This commit is contained in:
Théo Piboubès
2015-09-05 16:36:12 +02:00
parent e90dcc6e5c
commit a84ac2f61e

View File

@@ -28,6 +28,9 @@ class HomeHandler(web.RequestHandler):
class AuthHandler(web.RequestHandler): class AuthHandler(web.RequestHandler):
def initialize(self):
self.compact = os.environ.get('BROWSER') in ['w3m', 'links', 'elinks', 'lynx']
def get(self): def get(self):
global oauth_state global oauth_state
global oauth_code global oauth_code
@@ -39,6 +42,10 @@ class AuthHandler(web.RequestHandler):
self.render('auth.html', state=oauth_state, code=oauth_code, error=oauth_error) 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): class OAuthTool(object):
def __init__(self, reddit, stdscr=None, loader=None, def __init__(self, reddit, stdscr=None, loader=None,