[mod_python] Flexible imports

Colin Fox cfox at cfconsulting.ca
Sun Mar 7 11:37:17 EST 2004

Hash: SHA1

Gregory (Grisha) Trubetskoy wrote:
| Why don't you use the publisher handler for that?
| Grisha

There's something else as well - I've done a lot of work with Zope, and
I really like one aspect of their form processing logic.

If you name a form widget like "x.i:records", then there will be a
dictionary called x with a field called i. If you happen to have a form
that's built up of a set of values, this results in a list of dictionaries.

This is perfect for group-processing of data. Say, for example, you want
to edit a list of items. You could present a table with one row per
record that has a name field for the items. Each row in the table may
have two form variables:

<input type="hidden" name="items.id:records" value=1>
<input type="text" name="items.name:records" value="Blah">

The code that processes this form is handed a list of dictionaries, and
can simply go through that list and process them one at a time by name.

I've reimplemented this form processing logic myself for my CGIs, and
I'd like to do the same with mod_python. But it seems that a clever
mod_python feature - where you specify a function & parameters to call
for processing - would actually get in the way of this. For my form
processing, I just want the request object, I don't want it trying to
break down the parameters.

Can this be done with the publisher handler? This is something I already
have working (see my other email in this thread about .py & .xml files),
but that particular solution's only weakness is that it can't handle .py
files in arbitrary locations.

~  cf
Version: GnuPG v1.2.4 (GNU/Linux)


More information about the Mod_python mailing list