TWBlue does not open timelines for protected users when is not possible

This commit is contained in:
Manuel Cortez 2015-03-24 17:28:01 -06:00
parent 2e70cbc298
commit 15eb0f62ea
3 changed files with 15 additions and 2 deletions

View File

@ -631,7 +631,14 @@ class Controller(object):
dlg = dialogs.userSelection.selectUserDialog(users=users, default=default)
if dlg.get_response() == widgetUtils.OK:
buffer = self.get_best_buffer()
if utils.if_user_exists(buffer.session.twitter.twitter, dlg.get_user()) != None:
usr = utils.if_user_exists(buffer.session.twitter.twitter, dlg.get_user())
if usr != None:
if usr["protected"] == True:
if usr["following"] == False:
commonMessageDialogs.no_following()
return
answer = commonMessageDialogs.protected_user()
if answer == widgetUtils.NO: return
if dlg.get_action() == "tweets":
if dlg.get_user() in buffer.session.settings["other_buffers"]["timelines"]:
commonMessageDialogs.timeline_exist()

View File

@ -82,7 +82,7 @@ def get_all_users(tweet, conf):
def if_user_exists(twitter, user):
try:
data = twitter.show_user(screen_name=user)
return data["screen_name"]
return data
except TwythonError as err:
if err.error_code == 404:
return None

View File

@ -38,3 +38,9 @@ def timeline_exist():
def no_tweets():
return wx.MessageDialog(None, _(u"This user has no tweets. You can't open a timeline for this user"), _(u"Error!"), wx.ICON_ERROR).ShowModal()
def protected_user():
return wx.MessageDialog(None, _(u"This is a protected Twitter user. It means you can not open a timeline using the Streaming API. The user's tweets will not update due to a twitter policy. Do you want to continue?"), _(u"Warning"), wx.ICON_WARNING|wx.YES_NO).ShowModal()
def no_following():
return wx.MessageDialog(None, _(u"This is a protected user account, you need follow to this user for viewing your tweets or favourites."), _(u"Error"), wx.ICON_ERROR).ShowModal()