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.


Reply via email to