From 20c2f844f5c539ab2e9c173f9fa421c07034ef8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Wed, 1 Feb 2017 09:03:22 -0600 Subject: [PATCH] ViewProfile: Show error for suspended accounts --- doc/changelog.md | 2 +- src/controller/user.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/changelog.md b/doc/changelog.md index ee041171..6b617874 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -5,7 +5,7 @@ * Fixed a bug in long tweet parsing that was making TWBlue to disconnect the streaming API. [#103](https://github.com/manuelcortez/TWBlue/issues/103) * Now OCR will work in images from retweets. It fixes a bug where TWBlue was detecting images but couldn't apply OCR on them. [#105](https://github.com/manuelcortez/TWBlue/issues/105) * TWBlue won't try to load tweets already deleted, made with Twishort. Before, if someone posted a long tweet but deleted it in the Twishort's site, TWBlue was trying to load the tweet and it was causing problems in all the client. [#113](https://github.com/manuelcortez/TWBlue/issues/113) -* TWBlue shows an error message when you try to view the profile of a user that does not exist. [#114](https://github.com/manuelcortez/TWBlue/issues/114) +* TWBlue shows an error message when you try to view the profile of a user that does not exist or has been suspended. [#114,](https://github.com/manuelcortez/TWBlue/issues/114) [#115](https://github.com/manuelcortez/TWBlue/issues/115) ## Changes in version 0.88 and 0.89 diff --git a/src/controller/user.py b/src/controller/user.py index d99978b8..ffa80eec 100644 --- a/src/controller/user.py +++ b/src/controller/user.py @@ -4,6 +4,8 @@ import webbrowser import widgetUtils import output from wxUI.dialogs import update_profile, show_user +import logging +log = logging.getLogger("controller.user") from twython import TwythonError class profileController(object): @@ -24,6 +26,9 @@ class profileController(object): except TwythonError as err: if err.error_code == 404: wx.MessageDialog(None, _(u"That user does not exist"), _(u"Error"), wx.ICON_ERROR).ShowModal() + if err.error_code == 403: + wx.MessageDialog(None, _(u"User has been suspended"), _(u"Error"), wx.ICON_ERROR).ShowModal() + log.error("error %d: %s" % (err.error_code, err.msg)) return self.dialog = show_user.showUserProfile() string = self.get_user_info()