fixed twitter, thanks spametki
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user