[mod_python] An odd use of the publisher

Colin Fox cfox at cfconsulting.ca
Sat Mar 13 14:56:53 EST 2004

Hash: SHA1

Hi, all.

I'm doing something with the publisher that feels a little odd, but I
don't know of any other way to do it. I just wanted an opinion or two.

I'm building a site that works based on XML pages and python scripts. I
have an .htaccess file that sets things up such that the publisher gets
called for any .py file in my hierarchy, and a single xml handler gets
called for any xml file. All good.

The question comes with how I'm using the publisher. I want the ability
to execute python code from everywhere, but I don't want all the
processing that the publisher does for me - I just want a simple
execution. I would like to process the request object's form input
fields myself, rather than having them processed into FieldStorage
objects (since I'll just have to pull them out of FS objects), and I
want to be able to do redirections & return error codes.

The publisher processes input for me, and takes a string as a return
value for printing.

To get around the return issue, I'm finishing off my handler with this:

~    raise apache.SERVER_RETURN, apache.OK

I don't particularly like raising an exception as a normal return, but I
don't know any other way around it.

Am I missing something?

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


More information about the Mod_python mailing list