OK, I think I see what you're doing, but when I apply it to my
ultimate app as opposed to the test case, it doesn't work. Here's an
example that's practically identical to what I'm trying to do (some
names have been changed):

#view
def poll(job_id):
 
filename=db(db.mytable.job==job_id).select(db.mytable.filename).first()
  if filename:
    return show_job_results(job_id,filename)
  else:
    return show_wait_icon(job_id)

def show_job_results(job_id,filename):
  ... # this displays OK ... no need to discuss here

def show_wait_icon(job_id):
  return DIV(
    IMG(_src=URL(...path to wait icon .gif...),_alt='waiting'),
    SCRIPT("""
      function update_job_status() {
        ajax('refresh/%(id)d',['job-%(id)d'],':eval');
        return false;
      }
      setInterval('update_job_status()',5000);
      """%dict(id=job_id)
    ),
    _id='job-%(id)d'%job_id
  )

# controller
def refresh():
  if not len(request.args): return 'false'
  try: id=int(request.args(0))
  except: return 'false'
  return """
    jQuery("#job-%(id)d").html("%(poll)s");
    setInterval("update_job_status()",5000);
    """%dict(id=id,poll=poll(id))

The idea being, that as long as the job output file is missing, then
keep polling every 5 sec.

Reply via email to