Merge lp://staging/~kai-mast/friends/fix-retweets into lp://staging/friends
Proposed by
Kai Mast
Status: | Merged |
---|---|
Merged at revision: | 247 |
Proposed branch: | lp://staging/~kai-mast/friends/fix-retweets |
Merge into: | lp://staging/friends |
Diff against target: |
58 lines (+15/-8) 2 files modified
friends/protocols/twitter.py (+14/-7) friends/tests/test_twitter.py (+1/-1) |
To merge this branch: | bzr merge lp://staging/~kai-mast/friends/fix-retweets |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Bruce Park | Approve | ||
Review via email: mp+198019@code.staging.launchpad.net |
Description of the change
This branch fixes the truncation of retweets. It also allows to properly support RTs in the future.
Be free to correct my coding style ;)
To post a comment you must log in.
So this mostly looks good, but there's a bad idiom you used here that you also did in your previous MP:
58 + if "retweeted_status" in tweet: 'retweeted_ status' )
59 + shared_status = tweet.get(
There's just no need for this kind of "look before you leap" logic in python. At worst, it's a race condition, and at best it's inefficient.
What you really want to do is something more like this:
message = tweet.get( 'retweeted_ status' , {}).get('text', '') or tweet.get('text', '')
If you do that, then you also reduce the number of calls to _resolve_tco() to 1, meaning you can inline it (meaning it doesn't have to be it's own method anymore).
Also you have "entities = tweet.get( 'entities' , {})" in two different places, needlessly redundant.