diff --git a/VERSION b/VERSION index f94e7de7..f749cc6b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 1.99.4 (2011-12-25 12:24:19) stable +Version 1.99.4 (2011-12-25 12:33:19) stable diff --git a/applications/admin/controllers/default.py b/applications/admin/controllers/default.py index 681f4ac4..cc4e0039 100644 --- a/applications/admin/controllers/default.py +++ b/applications/admin/controllers/default.py @@ -1308,6 +1308,7 @@ def update_languages(): session.flash = T('Language files (static strings) updated') redirect(URL('design',args=app,anchor='languages')) + def twitter(): session.forget() session._unlock(response) @@ -1315,13 +1316,19 @@ def twitter(): import gluon.contrib.simplejson as sj try: if TWITTER_HASH: - page = gluon.tools.fetch('http://twitter.com/%s?format=json'%TWITTER_HASH) - return sj.loads(page)['#timeline'] + page = urllib.urlopen("http://search.twitter.com/search.json?q=%%40%s" % TWITTER_HASH).read() + data = sj.loads(page , encoding="utf-8")['results'] + d = dict() + for e in data: + d[e["id"]] = e + r = reversed(sorted(d)) + return dict(tweets = [d[k] for k in r]) else: return 'disabled' except Exception, e: return DIV(T('Unable to download because:'),BR(),str(e)) + def user(): if MULTI_USER_MODE: if not db(db.auth_user).count(): diff --git a/applications/admin/views/default/site.html b/applications/admin/views/default/site.html index 9b033073..e7c51d60 100644 --- a/applications/admin/views/default/site.html +++ b/applications/admin/views/default/site.html @@ -150,7 +150,7 @@

{{=T("%s Recent Tweets"%TWITTER_HASH)}}

{{=T('loading...')}}
{{pass}} diff --git a/applications/admin/views/default/twitter.load b/applications/admin/views/default/twitter.load new file mode 100644 index 00000000..3eb308b3 --- /dev/null +++ b/applications/admin/views/default/twitter.load @@ -0,0 +1,34 @@ +{{response.headers['web2py-response-flash']=response.flash}} + +{{ +""" +Tweet attributes + +'iso_language_code', +'to_user_name', +'to_user_id_str', +'profile_image_url_https', +'from_user_id_str', +'text', +'from_user_name', +'in_reply_to_status_id_str', +'profile_image_url', +'id', +'to_user', +'source', +'in_reply_to_status_id', +'id_str', +'from_user', +'from_user_id', +'to_user_id', +'geo', +'created_at', +'metadata' +""" +}} + +{{ for t in tweets: }} + {{ =DIV(H5(t["from_user_name"])) }} + {{ =DIV(t["text"]) }} + {{ =BR() }} +{{ pass }}