If you want to update some content on a web page every 30 minutes, the 
easiest approach is to use Ajax -- set a timer and make the Ajax call every 
30 minutes. The easiest way to do that in web2py is via an Ajax component 
(see 
http://web2py.com/books/default/chapter/29/12/components-and-plugins#Components--LOAD-and-Ajax).
 
In the view of the main page:

{{=LOAD('default', 'call_print.load', ajax=True, timeout=30*60, times=
'infinity')}}

The above will make a request to the call_print action every 30 minutes and 
display the returned HTML within a div in the page. call_print should be a 
standard controller action that returns HTML (though it should not extend 
the layout.html view, as its content will be embedded in its parent page).

Anthony

On Monday, July 11, 2016 at 2:11:38 AM UTC-4, Chetan Jain wrote:
>
> Hello Mates, 
>
>     Problem : I'm calling a function which runs executes every 30 minutes, 
> now i want to display content one after other webPage, how can i do it? For 
> example.
>
> def index():
>   redirects(URL('call_print"))
> return locals
>
>
> def call_print():
>
>   for i in range(1,10):
>     print i
>   time.sleep(30*60)
>   
>   call()
> return locals()
>
> I want call_print function to print 1...10 every time and appending 1...10 
> to existing webpage. How can i do it. 
> Doing in default/call_print.html file will display only after function 
> terminates, But i want to see it live.
>
> Any Help is highly appreciate.
>
> Thanks,
> Chetan Jain
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to