silent processing with python+modpython+cheetah

grahamd at dscpl.com.au grahamd at dscpl.com.au
Sat Oct 21 22:48:36 EDT 2006


Sai Krishna M wrote:
> Hi,
>
> I have been working for some time developing web pages using python,
> modpython, cheetah.
> I find that this method has come inherent difficulties in it like if
> we want to generate a single page we have to write two separate files
> ( py & tmpl).
> Is there any other better way of doing things.?

It sounds like you are actually using mod_python.publisher and hand
crafting the code to render the template file in each instance. Using
mod_python.publisher is not the same as using basic mod_python handlers
directly. If you were using basic mod_python handlers directly, you
certainly could write your own dispatcher which encapsulates in one
place the code needed to render a Cheetah template file, thereby
avoiding the need to create .py file corresponding to every Cheetah
template file.

> Also if we want to have partial processing of the pages, i.e, the
> value one chooses for a particular field determines the value to be
> entered for another field in the same page, how can it be done?

That sounds like an internal issue of how you use Cheetah templates
itself. Cheetah templates have flow control abilities, blocks etc such
that one can control what parts of a page are actually used.

Since mod_python inherently means you start out working at a low level,
and that you don't perhaps fully appreciate the different levels of
functionality in mod_python and how to use them, you are possibly
better off using a high level framework such as Django or TurboGears
where someone else has done all the hard work of making it simple to
use.

Graham




More information about the Python-list mailing list