
cherokee at cherokee-project
Oct 22, 2009, 7:01 AM
Post #1 of 1
(93 views)
Permalink
|
|
[3743] web/widgets/render-twitter.py: Fixes trimming to not mess up URLs
|
|
Revision: 3743 http://svn.cherokee-project.com/changeset/3743 Author: taher Date: 2009-10-22 16:01:43 +0200 (Thu, 22 Oct 2009) Log Message: ----------- Fixes trimming to not mess up URLs Modified Paths: -------------- web/widgets/render-twitter.py Modified: web/widgets/render-twitter.py =================================================================== --- web/widgets/render-twitter.py 2009-10-22 13:38:47 UTC (rev 3742) +++ web/widgets/render-twitter.py 2009-10-22 14:01:43 UTC (rev 3743) @@ -3,6 +3,7 @@ import simplejson as json from dateutil.parser import parse +MAX_SZ = 45 LIMIT = 6 URL = "http://twitter.com/statuses/user_timeline/webserver.json?count=%d" % LIMIT OUTPUT = "dynamic/cherokee-tweets.html" @@ -24,11 +25,12 @@ for entry in data: date = str(parse(entry['created_at'])).split('+')[0] - tweet = rc.sub(to_url, entry['text']) + text = entry['text'] - # Tidy up - #if len(tweet) > 45: - # tweet = tweet[:45] + " .." + # Tidy up (before reformatting URLs). + #if len(text) > MAX_SZ: + # text = text[:MAX_SZ-3] + " .." + tweet = rc.sub(to_url, text) content += tweet content += '<div class="latest-date"><b>%s</b></div>' % date
|