From: Edmund Lian <elian@in...> - 2001-11-06 08:41:22
Uh, I'm a bit stumped right now... I'm trying to figure out the best way to
use Cheetah and Webware, but the docs are a bit skimpy in this area. Here's
what I think I want to do:
1. Write HTML pages and templates with Cheetah.
2. Forms actions invoke formhandlers that start life as a Cheetah
3. The Cheetah templates that act as formhandlers just invoke methods in
one or more files that contain nothing but business logic.
So basically, I'm just trying to use Cheetah templates to process data
using back-end methods, and then display data returned.
The construction I'm trying to get to is how I used to separate logic from
HTML in AOLserver. There, each ASP-style page consisted of Tcl code at the
top of the file to fetch form data, process it, and prepare data for
display. The bottom of the file was pure HTML sprinkled with ASP-like
variable substitutions. This worked very well in terms of separating UI
from logic since any duffer could use Homesite to fiddle with the HTML.
With Webware/Cheetah, I thought that the next logical thing to do would be
to move all the code out of the HTML templates.
I have three questions right now:
1. How do I pass form input to the back-end routines?
2. How do I instantiate objects from Cheetah?
3. Am I barking up the wrong tree? Are there better ways of separating UI
from application logic? I don't like embedding HTML in Python, the way one
has to if you just subclass Page.py or the HTTPServlet.