Display value on a web page

36 views
Skip to first unread message

Fabio Gubler

unread,
Sep 6, 2019, 10:17:29 PM9/6/19
to web2py-users
I've realized the scheduler example shown on Vimeo video by M. Di Pierro and it works properly.
Now I'd like to show the time value on the web page (with a view).
Could somebody give me an idea about how should I proceed?
Should I create a Python module? and how to pass the time value from Model to controller function?
Thanks in advance for any help.
Fabio

Dave S

unread,
Sep 11, 2019, 4:22:02 AM9/11/19
to web2py-users
I shouldn't be answering this question without taking the time to see the video, because I don't really know where you're statring at,  but I'll see what I can do.

1.  In web2py, you need a controller function to respond to user requests.

2.  The controller function is invoked with a context that includes the request and the globals from the model files.
The globals include the DAL object specified (named "db" in all the examples) and the Scheduler object.  In the controller, you use the scheduler object to queue tasks or to check the task status.

3.  What the controller function returns is used to display things in the view.  If you query the task status in the controller, then you can return the values from the status.

What time is it that you want to display?  Do you want to know when it last ran or when it will next run?  Those times are in the status.

BTW, I recommend looking over Chapter 3 of the book.  Simple examples, probably simpler than the video, but it will help you keep in mind how the pieces go together.

/dps





Reply all
Reply to author
Forward
0 new messages