Re: [web2py] Re: How to have a view getting data from a long running time controller ?

2018-02-19 Thread Val K
keep in mind, that production servers have buffering. For example, if you 
are using  nginx you should turn off 'proxy_buffering' for the 'streamer' 
location.

On Monday, February 19, 2018 at 4:40:43 PM UTC+3, Ramos wrote:
>
> Thank you.
> It works ...
>
> 2018-02-19 12:00 GMT+00:00 Val K :
>
>> I don't have PY3, so can't test. If it's bytes, then it 's already 
>> encoded and all should work OK. Try ...xml().decode().encode('utf-8')  or 
>> try to yield something simple  - just 'hello'
>>
>> On Sunday, February 18, 2018 at 11:40:40 PM UTC+3, Ramos wrote:
>>>
>>> Stil some error about no attribute encode
>>> [image: Imagem inline 1]
>>>
>>> 2018-02-18 0:40 GMT+00:00 Val K :
>>>
 try  encode yield:
 yield DIV(...).xml().encode('utf-8')



 On Sunday, February 18, 2018 at 3:36:13 AM UTC+3, Ramos wrote:
>
> i think i misplaced axios.min.js
>
> second try and got this error
> [image: Imagem inline 1]
> and after 3 seconds i got this 
>
> [image: Imagem inline 2]
>
>
> Regards
> António
>
>
>
> 2018-02-17 22:38 GMT+00:00 Val K :
>
>> As I see it's PY3, I tested on PY2. As I know in PY3 all strings are 
>> unicode, so, It is necessary to dig in this direction
>>
>>
>> On Saturday, February 17, 2018 at 10:46:40 PM UTC+3, Ramos wrote:
>>>
>>> I tried your simple example but when i click on the button i get 
>>> "Server Error" above the button
>>>
>>> then in admin i see this
>>> [image: Imagem inline 1]
>>> any help
>>> Regards
>>>
>>> 2018-02-16 23:48 GMT+00:00 Val K :
>>>
 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: 100,
   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+un...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> -- 
>> 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+un...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - 

Re: [web2py] Re: How to have a view getting data from a long running time controller ?

2018-02-19 Thread António Ramos
Thank you.
It works ...

2018-02-19 12:00 GMT+00:00 Val K :

> I don't have PY3, so can't test. If it's bytes, then it 's already encoded
> and all should work OK. Try ...xml().decode().encode('utf-8')  or try to
> yield something simple  - just 'hello'
>
> On Sunday, February 18, 2018 at 11:40:40 PM UTC+3, Ramos wrote:
>>
>> Stil some error about no attribute encode
>> [image: Imagem inline 1]
>>
>> 2018-02-18 0:40 GMT+00:00 Val K :
>>
>>> try  encode yield:
>>> yield DIV(...).xml().encode('utf-8')
>>>
>>>
>>>
>>> On Sunday, February 18, 2018 at 3:36:13 AM UTC+3, Ramos wrote:

 i think i misplaced axios.min.js

 second try and got this error
 [image: Imagem inline 1]
 and after 3 seconds i got this

 [image: Imagem inline 2]


 Regards
 António



 2018-02-17 22:38 GMT+00:00 Val K :

> As I see it's PY3, I tested on PY2. As I know in PY3 all strings are
> unicode, so, It is necessary to dig in this direction
>
>
> On Saturday, February 17, 2018 at 10:46:40 PM UTC+3, Ramos wrote:
>>
>> I tried your simple example but when i click on the button i get
>> "Server Error" above the button
>>
>> then in admin i see this
>> [image: Imagem inline 1]
>> any help
>> Regards
>>
>> 2018-02-16 23:48 GMT+00:00 Val K :
>>
>>> 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: 100,
>>>   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+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> 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+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

 --
>>> 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+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> Resources:
> - 

Re: [web2py] Re: How to have a view getting data from a long running time controller ?

2018-02-19 Thread Val K
I don't have PY3, so can't test. If it's bytes, then it 's already encoded 
and all should work OK. Try ...xml().decode().encode('utf-8')  or try to 
yield something simple  - just 'hello'

On Sunday, February 18, 2018 at 11:40:40 PM UTC+3, Ramos wrote:
>
> Stil some error about no attribute encode
> [image: Imagem inline 1]
>
> 2018-02-18 0:40 GMT+00:00 Val K :
>
>> try  encode yield:
>> yield DIV(...).xml().encode('utf-8')
>>
>>
>>
>> On Sunday, February 18, 2018 at 3:36:13 AM UTC+3, Ramos wrote:
>>>
>>> i think i misplaced axios.min.js
>>>
>>> second try and got this error
>>> [image: Imagem inline 1]
>>> and after 3 seconds i got this 
>>>
>>> [image: Imagem inline 2]
>>>
>>>
>>> Regards
>>> António
>>>
>>>
>>>
>>> 2018-02-17 22:38 GMT+00:00 Val K :
>>>
 As I see it's PY3, I tested on PY2. As I know in PY3 all strings are 
 unicode, so, It is necessary to dig in this direction


 On Saturday, February 17, 2018 at 10:46:40 PM UTC+3, Ramos wrote:
>
> I tried your simple example but when i click on the button i get 
> "Server Error" above the button
>
> then in admin i see this
> [image: Imagem inline 1]
> any help
> Regards
>
> 2018-02-16 23:48 GMT+00:00 Val K :
>
>> 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: 100,
>>   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+un...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> -- 
 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+un...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> -- 
>> 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+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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

Re: [web2py] Re: How to have a view getting data from a long running time controller ?

2018-02-18 Thread António Ramos
Stil some error about no attribute encode
[image: Imagem inline 1]

2018-02-18 0:40 GMT+00:00 Val K :

> try  encode yield:
> yield DIV(...).xml().encode('utf-8')
>
>
>
> On Sunday, February 18, 2018 at 3:36:13 AM UTC+3, Ramos wrote:
>>
>> i think i misplaced axios.min.js
>>
>> second try and got this error
>> [image: Imagem inline 1]
>> and after 3 seconds i got this
>>
>> [image: Imagem inline 2]
>>
>>
>> Regards
>> António
>>
>>
>>
>> 2018-02-17 22:38 GMT+00:00 Val K :
>>
>>> As I see it's PY3, I tested on PY2. As I know in PY3 all strings are
>>> unicode, so, It is necessary to dig in this direction
>>>
>>>
>>> On Saturday, February 17, 2018 at 10:46:40 PM UTC+3, Ramos wrote:

 I tried your simple example but when i click on the button i get
 "Server Error" above the button

 then in admin i see this
 [image: Imagem inline 1]
 any help
 Regards

 2018-02-16 23:48 GMT+00:00 Val K :

> 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: 100,
>   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+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

 --
>>> 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+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> 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.
>

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


Re: [web2py] Re: How to have a view getting data from a long running time controller ?

2018-02-17 Thread Val K
try  encode yield:
yield DIV(...).xml().encode('utf-8')



On Sunday, February 18, 2018 at 3:36:13 AM UTC+3, Ramos wrote:
>
> i think i misplaced axios.min.js
>
> second try and got this error
> [image: Imagem inline 1]
> and after 3 seconds i got this 
>
> [image: Imagem inline 2]
>
>
> Regards
> António
>
>
>
> 2018-02-17 22:38 GMT+00:00 Val K :
>
>> As I see it's PY3, I tested on PY2. As I know in PY3 all strings are 
>> unicode, so, It is necessary to dig in this direction
>>
>>
>> On Saturday, February 17, 2018 at 10:46:40 PM UTC+3, Ramos wrote:
>>>
>>> I tried your simple example but when i click on the button i get "Server 
>>> Error" above the button
>>>
>>> then in admin i see this
>>> [image: Imagem inline 1]
>>> any help
>>> Regards
>>>
>>> 2018-02-16 23:48 GMT+00:00 Val K :
>>>
 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: 100,
   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+un...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> -- 
>> 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+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


Re: [web2py] Re: How to have a view getting data from a long running time controller ?

2018-02-17 Thread António Ramos
i think i misplaced axios.min.js

second try and got this error
[image: Imagem inline 1]
and after 3 seconds i got this

[image: Imagem inline 2]


Regards
António



2018-02-17 22:38 GMT+00:00 Val K :

> As I see it's PY3, I tested on PY2. As I know in PY3 all strings are
> unicode, so, It is necessary to dig in this direction
>
>
> On Saturday, February 17, 2018 at 10:46:40 PM UTC+3, Ramos wrote:
>>
>> I tried your simple example but when i click on the button i get "Server
>> Error" above the button
>>
>> then in admin i see this
>> [image: Imagem inline 1]
>> any help
>> Regards
>>
>> 2018-02-16 23:48 GMT+00:00 Val K :
>>
>>> 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: 100,
>>>   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+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> 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.
>

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


Re: [web2py] Re: How to have a view getting data from a long running time controller ?

2018-02-17 Thread Val K
As I see it's PY3, I tested on PY2. As I know in PY3 all strings are 
unicode, so, It is necessary to dig in this direction


On Saturday, February 17, 2018 at 10:46:40 PM UTC+3, Ramos wrote:
>
> I tried your simple example but when i click on the button i get "Server 
> Error" above the button
>
> then in admin i see this
> [image: Imagem inline 1]
> any help
> Regards
>
> 2018-02-16 23:48 GMT+00:00 Val K :
>
>> 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: 100,
>>   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+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


Re: [web2py] Re: How to have a view getting data from a long running time controller ?

2018-02-17 Thread António Ramos
I tried your simple example but when i click on the button i get "Server
Error" above the button

then in admin i see this
[image: Imagem inline 1]
any help
Regards

2018-02-16 23:48 GMT+00:00 Val K :

> 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: 100,
>   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.
>

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


Re: [web2py] Re: How to have a view getting data from a long running time controller ?

2018-02-16 Thread António Ramos
Will try it...
I knew i would need a Yield !!
Many thanks for your time

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.


Re: [web2py] Re: How to have a view getting data from a long running time controller ?

2018-02-14 Thread Dave S


On Tuesday, February 13, 2018 at 1:43:11 PM UTC-8, Ramos wrote:
>
> but the idea is to get some of the data as it is being calculated in the 
> controller.
>

For that I would use a stream.  There are a couple of examples that have 
popped up here on occasion, although I can't at the moment link to them.  
Which stream module you use may depend on whether your results are 
text/html, or binary data (like a video).  I think I have an example at 
home for that I used for returning a jpg, but my glasses aren't good enough 
to see it from here.

/dps
 

>
> 2018-02-13 21:38 GMT+00:00 黄祥 :
>
>> just an idea, perhaps you can use loading animation (javascript, etc) in 
>> the view during waiting the long awaited data so that the user dont get 
>> bored, after the data is calculated, you can show the data in the view 
>> (replace the loading animation).
>>
>> best regards,
>> stifan
>>
>> -- 
>> 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+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


Re: [web2py] Re: How to have a view getting data from a long running time controller ?

2018-02-14 Thread Anthony
On Tuesday, February 13, 2018 at 4:43:11 PM UTC-5, Ramos wrote:
>
> but the idea is to get some of the data as it is being calculated in the 
> controller.
>

One option would be to use the web2py scheduler to run the calculations as 
a background task. As results are generated, they could temporarily be 
stored in a special database table. From the browser, you can then make 
periodic Ajax requests (perhaps every few seconds) to check for new results 
in the special table.

As an alternative to the Ajax polling, you could use server push (e.g., 
Websockets or Server Sent Events) to push results to the browser. If you 
want to take that approach, consider external pubsub servers such as Nchan 
 or Centrifugo 
, or realtime services such as 
Realtime.co, Ably, Pusher, Pubnub, or Firebase.

Anthony

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


Re: [web2py] Re: How to have a view getting data from a long running time controller ?

2018-02-13 Thread António Ramos
but the idea is to get some of the data as it is being calculated in the
controller.

2018-02-13 21:38 GMT+00:00 黄祥 :

> just an idea, perhaps you can use loading animation (javascript, etc) in
> the view during waiting the long awaited data so that the user dont get
> bored, after the data is calculated, you can show the data in the view
> (replace the loading animation).
>
> best regards,
> stifan
>
> --
> 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.
>

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