Note, that will consume one of your web server processes/threads for the 
entire duration of the processing -- might be better with an async server 
like gevent.

Anthony

On Friday, February 16, 2018 at 6:48:56 PM UTC-5, Val K wrote:
>
> Just a very simple example using https://github.com/axios/axios
>
>
> def long_load():
>     ret = DIV()
>     ret.append(SCRIPT(_src=URL('static/js','axios.min.js')))
>     ret.append(SCRIPT(
>     """
>         function DownLoadTick(e){
>             document.getElementById("result").innerHTML = 
> e.target.response;             
>         };
>               function long_load(){
>             axios({
>               url: 'streamer',
>               timeout: 1000000,
>               onDownloadProgress: DownLoadTick,
>               withCredentials: true
>             });
>         };    
>     """    
>     ))
>     ret.append(DIV(_id='result'))
>     ret.append(BUTTON('click me', _onclick = 'long_load()'))
>     return dict(ret=ret)
>
> def streamer():
>     i=0
>     while True:
>         # do something for a long time    
>         time.sleep(1)
>         yield DIV('part %s' % i).xml()
>         i+=1
>         if i>5: 
>             yield DIV('Done!').xml()
>             break
>
>
>
>
>
>
> On Tuesday, February 13, 2018 at 10:28:13 PM UTC+3, Ramos wrote:
>>
>> Hello i have a controller that scans a lot of databases searching for 
>> some data.
>> The view in the end gets that data a makes a dashboard.
>>
>> If the controller takes 10 minutes , the view is blank for 10 minutes and 
>> that is not a good thing for the user.
>>
>> How can i have the controller to send the data to the view and the view 
>> to display data as it is being calculated from the controller?
>> Is it possible in a simple manner?
>>
>>
>>
>> Regards
>> António
>>
>

-- 
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