diff --git a/doc/changelog.md b/doc/changelog.md index 73648bd6..637d5f6d 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -5,6 +5,7 @@ * Fixed error when displaying an URL at the end of a line, when the tweet or direct message contained multiple lines. Now the URL should be displayed correctly. ((#305,)[https://github.com/manuelcortez/TWBlue/issues/305]) * TWBlue has been migrated completely to Python 3 (currently, the software builds with Python 3.7). * TWBlue should be restarted gracefully. Before, the application was alerting users of not being closed properly every time the application restarted by itself. +* If TWBlue attemps to load an account with invalid tokens (this happens when reactivating a previously deactivated account, or when access to the ap is revoqued), TWBlue will inform the user about this error and will skip the account. Before, the app was unable to start due to a critical error. ## Changes in version 0.95 diff --git a/src/sessionmanager/sessionManager.py b/src/sessionmanager/sessionManager.py index 91d26beb..d6a39c90 100644 --- a/src/sessionmanager/sessionManager.py +++ b/src/sessionmanager/sessionManager.py @@ -21,7 +21,7 @@ from sessions.twitter import session from . import manager import config_utils import config - +from twython.exceptions import TwythonAuthError log = logging.getLogger("sessionmanager.sessionManager") class sessionManagerController(object): @@ -85,11 +85,18 @@ class sessionManagerController(object): s = session.Session(i) s.get_configuration() if i not in config.app["sessions"]["ignored_sessions"]: - s.login() + try: + s.login() + except TwythonAuthError: + self.show_auth_error(s.settings["twitter"]["user_name"]) + continue sessions.sessions[i] = s self.new_sessions[i] = s # self.view.destroy() + def show_auth_error(self, user_name): + error = view.auth_error(user_name) + def manage_new_account(self, *args, **kwargs): if self.view.new_account_dialog() == widgetUtils.YES: location = (str(time.time())[-6:]) diff --git a/src/sessionmanager/wxUI.py b/src/sessionmanager/wxUI.py index 51b7ac9d..fccfcdbf 100644 --- a/src/sessionmanager/wxUI.py +++ b/src/sessionmanager/wxUI.py @@ -75,4 +75,7 @@ class sessionManagerWindow(wx.Dialog): self.configuration.Hide() def destroy(self): - self.Destroy() \ No newline at end of file + self.Destroy() + +def auth_error(user_name): + return wx.MessageDialog(None, _("TWBlue is unable to authenticate the account for {} in Twitter. It might be due to an invalid or expired token, revoqued access to the application, or after an account reactivation. Please remove the account manually from your Twitter sessions in order to stop seeing this message.").format(user_name,), _("Authentication error for session {}").format(user_name,), wx.OK).ShowModal()