Hi all,

I want to display/update several metrics in a normal page (not in a form). 
These metrics got updated every minute and were stored in a log file. I 
prepared a function to open that log file then analyze the last several 
lines to collect them. I want these metrics got updated in every page 
load/refresh.

The first method I considered is to utilize Templetor (
http://webpy.org/docs/0.3/templetor).  I used $code block in the template 
but figured out soon that this solution won't work for the security reason. 
In my function I use open which is prohibited by webpy.

Then I thought of `Import functions into templates` (
https://github.com/webpy/webpy.github.com/blob/master/cookbook/template_import.md).
 
In my case, there is no argument for that function. I followed the 
instruction but got the following error.

checknow() takes no arguments (1 given)
>

#in my application.py:
def checknow():
...
    return TN_str

render = web.template.render('templates/',globals={'stat':checknow})

#in the template:
$def with(checknow)
... ...
    <h1><div>Test: $stat(checknow)</div></h1>

By the way, how to refer multiple values of the function checknow()? The 
function checknow() should return multiple values in the real case. Could 
you please help me out? Thanks a lot.

Best Regards,
-Yongzhi

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to