go look at the bottom of /web2py/applications/admin/default/site.html and you'll see how Massimo does it:
<div style="background-color: #CCCCCC; padding: 5px;"> <h3>{{=T("web2py Recent Tweets")}}</h3> <div id="tweets">{{=T('loading...')}}</div> <script> jQuery(document).ready(function(){jQuery('#tweets').load('{{=URL(r=request,f='twitter')}}')}); </script> </div> then in admin/controllers/default.py you'll find: def twitter(): session.forget() session._unlock(response) import gluon.tools import gluon.contrib.simplejson as sj try: page = gluon.tools.fetch('http://twitter.com/web2py?format=json') return sj.loads(page)['#timeline'] except: return T('Unable to download') -wes On Fri, Nov 20, 2009 at 10:47 AM, Leandro - ProfessionalIT <lsever...@gmail.com> wrote: > > Hi, > I'm trying to implement the feature that show the 'tweets' of my > twitter account in the index page of my blog(hosted in GAE) based in > the code of admin controller, but it don't run !. In my tests it can't > connect with twitter. It's a bug/bad implementation of my controller > or the GAE don't accepts this feature ? > > My code in default controller: > > def get_tweets(): > from gluon.tools import fetch > import gluon.contrib.simplejson as sj > page = fetch('http://twitter.com/myaccount?format=json') > return sj.loads(page)['#timeline'] > > My Page: > <ul class="twittadas"> > <li> > <div id="tweets">{{=T('loading...')}}</div> > <script> > jQuery(document).ready(function(){jQuery('#tweets').load('{{=URL > (r=request,f='get_tweets')}}')}); > </script> > </div> > </li> > </ul> > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---