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,7 +994,8 @@ 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"])
self.view.change_buffer(buffer) if buffer!=None:
self.view.change_buffer(buffer)
def up(self, *args, **kwargs): def up(self, *args, **kwargs):
page = self.get_current_buffer() page = self.get_current_buffer()

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:
log.debug("Logging in to twitter...") try:
self.twitter.login(self.settings["twitter"]["user_key"], self.settings["twitter"]["user_secret"], verify_credentials) log.debug("Logging in to twitter...")
self.logged = True self.twitter.login(self.settings["twitter"]["user_key"], self.settings["twitter"]["user_secret"], verify_credentials)
log.debug("Logged.") self.logged = True
self.counter = 0 log.debug("Logged.")
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