Sorry my bad: {{=XML(expand_one(' http://www.youtube.com/watch?v=7yvt2Pt6LRA',cache.ram('mycache',lambda:dict(),3600))<http://www.youtube.com/watch?v=7yvt2Pt6LRA')> )}}
expand one converts to HTML but then is must be wrapped into XML else it gets escaped. On Friday, 1 February 2013 19:10:12 UTC-6, sasogeek wrote: > > when the page loads and i click on view page source, here's what's there... > > <iframe width="480" height="270" src=" > http://www.youtube.com/embed/7yvt2Pt6LRA?feature=oembed" > frameborder="0" allowfullscreen></iframe> > > and it appears as html on the actual page... > > > On Saturday, 2 February 2013 00:47:26 UTC, Massimo Di Pierro wrote: >> >> If you need it in a view >> >> {{from gluon.contrib.autolinks import expand_one}} >> >> Mind that expend_one may call a service (oembed service). This may may >> delay the generation of the page and even block it if the service is not >> available. The second argument of expand one is a dictionary and it uses to >> cache the expanded links. You can do >> >> {{=expand_one(' >> http://www.youtube.com/watch?v=7yvt2Pt6LRA',cache.ram('mycache',lambda:dict(),3600))<http://www.youtube.com/watch?v=7yvt2Pt6LRA')> >> }} >> >> and this will keep the expended links cached for 3600 seconds in the >> dict() The dict will be persistant in ram. >> >> >> >> On Friday, 1 February 2013 17:25:04 UTC-6, sasogeek wrote: >>> >>> where do I put the import statement? >>> >>> On Friday, 18 January 2013 16:02:27 UTC, Massimo Di Pierro wrote: >>>> >>>> from gluon.contrib.autolinks import expand_one >>>> >>>> {{=expand_one('http://www.youtube.com/watch?v=7yvt2Pt6LRA')}} >>>> >>>> On Friday, 18 January 2013 04:58:20 UTC-6, sasogeek wrote: >>>>> >>>>> at the moment, i can let users upload pictures and use the img tag to >>>>> allow the image to be displayed on a page, when users upload videos, how >>>>> do >>>>> i allow the videos to display and play on the page... and if users submit >>>>> a >>>>> youtube link, how do i grab the embed code to display the video on the >>>>> page? >>>> >>>> -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.