TWBlue can run successfully if there are no sessions configured to run at program startup or the Internet connection doesn't work (for example, you are behind a proxy but you haven't configured it yet)

This commit is contained in:
Jose Manuel Delicado 2017-02-13 13:35:32 +01:00
parent b165d564e0
commit 1061967adc
2 changed files with 11 additions and 6 deletions

View File

@ -994,6 +994,7 @@ class Controller(object):
if buffer != None: break if buffer != None: break
else: else:
buffer = self.view.search("home_timeline", buf.session.db["user_name"]) buffer = self.view.search("home_timeline", buf.session.db["user_name"])
if buffer!=None:
self.view.change_buffer(buffer) self.view.change_buffer(buffer)
def up(self, *args, **kwargs): def up(self, *args, **kwargs):

View File

@ -135,11 +135,15 @@ class Session(object):
if the user account isn't authorised, it needs to call self.authorise() before login.""" if the user account isn't authorised, it needs to call self.authorise() before login."""
if self.settings["twitter"]["user_key"] != None and self.settings["twitter"]["user_secret"] != None: if self.settings["twitter"]["user_key"] != None and self.settings["twitter"]["user_secret"] != None:
try:
log.debug("Logging in to twitter...") log.debug("Logging in to twitter...")
self.twitter.login(self.settings["twitter"]["user_key"], self.settings["twitter"]["user_secret"], verify_credentials) self.twitter.login(self.settings["twitter"]["user_key"], self.settings["twitter"]["user_secret"], verify_credentials)
self.logged = True self.logged = True
log.debug("Logged.") log.debug("Logged.")
self.counter = 0 self.counter = 0
except:
log.error("The login attempt failed.")
self.logged = False
else: else:
self.logged = False self.logged = False
raise Exceptions.RequireCredentialsSessionError raise Exceptions.RequireCredentialsSessionError