From 7d1b47408608de80f51b314781f1df5dfcd88e95 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Sat, 12 Dec 2009 12:35:41 -0200 Subject: [PATCH] Repost works --- mitterlib/network/twitter.py | 10 ++++++---- mitterlib/ui/ui_pygtk.py | 9 --------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/mitterlib/network/twitter.py b/mitterlib/network/twitter.py index 6e8779a..90b9c16 100644 --- a/mitterlib/network/twitter.py +++ b/mitterlib/network/twitter.py @@ -133,7 +133,8 @@ class TwitterNetworkData(NetworkData): # Twitter encodes a lot of HTML entities, which are not good when # you want to *display* then (e.g., "<" returns to us as "<"). - # So we convert this here. + # So we convert this here. Interfaces need to worry about converting + # them if it becomes a problem. self.message = _unhtml(data['text']) return @@ -405,8 +406,9 @@ class Connection(NetworkBase): def repost(self, message): """Repost a message.""" - body = {'id': message.id} # Force a body to make it a POST. - data = self._request('/statuses/retweet.json', body=body) + body = urllib.urlencode({'id': message.id}) + resource = '/statuses/retweet/%d.json' % (message.id) + data = self._request(resource, body=body) return TwitterNetworkData(data) def delete_message(self, message): @@ -435,4 +437,4 @@ class Connection(NetworkBase): def can_repost(self, message): """Twitter ignores retweets from the user.""" return not (message.username == - self._options[self.NAMESPACE]['username']) \ No newline at end of file + self._options[self.NAMESPACE]['username']) diff --git a/mitterlib/ui/ui_pygtk.py b/mitterlib/ui/ui_pygtk.py index 51d4d5e..35391cd 100644 --- a/mitterlib/ui/ui_pygtk.py +++ b/mitterlib/ui/ui_pygtk.py @@ -638,12 +638,6 @@ class Interface(object): self._reply_label.set_text('') return - def _clear_repost(self): - """Clear the info about a repost.""" - self._repost_message_id = None - self._reply_label.set_text('') - return - # ------------------------------------------------------------ # Widget callback functions # ------------------------------------------------------------ @@ -683,7 +677,6 @@ class Interface(object): self._delete_iter = None self._clear_reply() - self._clear_repost() return @@ -882,7 +875,6 @@ class Interface(object): self._clear_text(None) self._update_statusbar('Your status was updated.') self._clear_reply() - self._clear_repost() return def _exception_update_status(self, widget, exception): @@ -954,7 +946,6 @@ class Interface(object): # interthread communication. self._delete_iter = None self._reply_message_id = None - self._repost_message_id = None return