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 <[email protected] <javascript:>>:
>
>> 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 <[email protected]>:
>>>
>>>> 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 [email protected].
>>>> 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 [email protected] <javascript:>.
>> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.