Like the title says, I'm having issues with web.py.

I have a script that starts a web.py instance and is serving basic
pages. Using the web.py template system, I'm able to get functions
like time.time() to refresh every time I reload(meaning, when I
refresh, the time printed has increased). However, I have a self
written function that performs some math and returns a multiline
string. When the function is called either from a script or on the
command line, it returns a different value each time, however, when I
call it using the web.py templating system, it seems to only run the
function once, and then will not re-run it again on additional page
reloads (even though time.time() updates each time). The only way to
get it to re-run is to restart the script.

Here's the function in question:

    def casecount():
      curcount = 80
      sc = startcount(date)
      delta = sc - curcount
      pace = float(delta) / float(ElTime(time, "9:00"))
      eta = float(curcount) / float(pace)
      return '''We started with %d cases as of 9AM<br>
      Remaining cases as of %s: %d<br>
      We\'re working at a pace of %.3f cases per hour. At this rate,
we will finish in approximately %.3f hours<br>''' % (sc, time,
curcount, pace, eta)
Obviously there are other functions I've written that the script
calls, but I know for a fact that it works when run on its own.

I'm providing function access to the web.py templating system using
this code:

    render = web.template.render('templates/', cache=False,
globals={'cc': casecount, 'time': time} )
and finally, I'm calling the code in the template with this:

    <html>
    <head>
    </head>
    <body>
    $time()
    $cc()
    </body>
    </html>
Any ideas? I've been at it for a while and have searched google to no
avail.

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to