Skip to content
This repository has been archived by the owner on Mar 2, 2021. It is now read-only.

Commit

Permalink
fix bug with broken ids
Browse files Browse the repository at this point in the history
  • Loading branch information
lucahammer committed Jan 3, 2016
1 parent aac98ab commit 7fe43d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions default/main/control/tweets.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def tweets():
tweets = api.home_timeline(count=30)
tweetstring = '{"tweets":['
for status in tweets:
tweetstring += '{"status":'+json.dumps(status.text)+',"account":"'+status.user.screen_name+'","avatar":"'+status.user.profile_image_url+'", "id":"'+status.id_str+'"},'
tweetstring += '{"status":'+json.dumps(status.text)+',"account":"'+status.user.screen_name+'","avatar":"'+status.user.profile_image_url+'", "id":"'+str(status.id_str)+'"},'
max_tweet_id = status.id_str
tweetstring = tweetstring[:-1] #removing that last ',' to get valid json
tweetstring += '], "max_tweet_id":"'+max_tweet_id+'"}'
tweetstring += '], "max_tweet_id":"'+str(max_tweet_id)+'"}'

return flask.render_template('tweets.json', html_class='tweets',tweets=tweetstring,)
2 changes: 2 additions & 0 deletions default/main/templates/bit/script.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@
writeSummary();
}).fail( function(data, textStatus, error) {
console.error("getJSON failed, status: " + textStatus + ", error: "+error);
localStorage.setItem('max_tweet_id', '0');
console.log("Resetting max_id");
});
}};

Expand Down

0 comments on commit 7fe43d3

Please sign in to comment.