On Thursday, November 2, 2017 at 5:03:34 PM UTC-7, Dave S wrote:
[...]

> I was able to add this to layout.html (after line 33 in my 2.14.6 copy) 
> and get expected results:
>
>   {{ if "lsrefresh" in globals():}}
>   <meta http-equiv="refresh" content={{=lsrefresh}} />
>   {{else:}}<!-- NO REFRESH -->
>   {{pass}}
>
> I tried using CAT to wrap the strings, but that made a lot of headers 
> disappear, probably because of escaping issues.  Now I just have to get my 
> controller function to calculate lsrefresh intelligently.
>

And, as a footnote, the following seems to satisfactory for my use:

    logdelta = (request.now - results[0]["logtime"])
    if logdelta < datetime.timedelta(seconds=600):
       refreshdelay=logdelta.seconds / 2
    else:
       refreshdelay = 0
    if refreshdelay == 0:
       return dict(records=results)
    return dict(records=results, lsrefresh=refreshdelay)

(there doesn't seem to be a magic value that let's the "content=" part of 
the head specify an infinite refresh interaval)

/dps

 

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