Merge lp:~roignac/gwibber/Bug352226-digg-internal-errors into lp:gwibber

Proposed by Vadim Rutkovsky
Status: Merged
Merged at revision: 886
Proposed branch: lp:~roignac/gwibber/Bug352226-digg-internal-errors
Merge into: lp:gwibber
Diff against target: 23 lines (+9/-4)
1 file modified
gwibber/microblog/digg.py (+9/-4)
To merge this branch: bzr merge lp:~roignac/gwibber/Bug352226-digg-internal-errors
Reviewer Review Type Date Requested Status
Ken VanDine Approve
Review via email: mp+36788@code.launchpad.net

Description of the change

A small fix for Digg - handle internal Digg errors correctly

To post a comment you must log in.
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Approved, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gwibber/microblog/digg.py'
2--- gwibber/microblog/digg.py 2010-04-11 22:15:31 +0000
3+++ gwibber/microblog/digg.py 2010-09-27 20:48:41 +0000
4@@ -65,10 +65,15 @@
5 def _get(self, path, parse="story", post=False, single=False, **args):
6 url = "/".join((URL_PREFIX, path)) + "?appkey=http://gwibber.com&type=json"
7
8- data = network.Download(url, util.compact(args) or None, post).get_json()["stories"]
9- if single: return [getattr(self, "_%s" % parse)(data)]
10- if parse: return [getattr(self, "_%s" % parse)(m) for m in data]
11- else: return []
12+ data = network.Download(url, util.compact(args) or None, post).get_json()
13+ if "stories" in data:
14+ if single: return [getattr(self, "_%s" % parse)(data["stories"])]
15+ if parse: return [getattr(self, "_%s" % parse)(m) for m in data["stories"]]
16+ else: return []
17+ else:
18+ if ("status" in data) and ("message" in data):
19+ print "Digg: got message with status %s and message %s" % (data["status"], data["message"])
20+ return []
21
22 def __call__(self, opname, **args):
23 return getattr(self, opname)(**args)