[mod_python] handling virtual files

Alejandro Mery amery at geeks.cl
Sat Jul 16 10:07:08 EDT 2005

> In mod_python 3.X, req.filename can be modified. It was read only
> in mod_python 2.7 though.

nice :-)

> What base handler were you thinking of using, were you thinking
> of starting with something like mod_python.publisher or writing
> your own handlers from scratch?

my own PythonHandler-s from scratch. I want to write handlers for the 
different kind of folders and for the different kind of file, but 
keeping file handlers also usable as direct handlers. for example a 
handler to render dir/foo.xmi as png and dir/foo.xmi?height=200 with 
that fixed height and scaling. or html from .tex files, with 
foo.txt?pdf=yes&papersize=letter options even if files are real or not.
i mean, to be called by folder handler or directly by apache.

> In respect of req.filename, its use becomes limited in a system
> where you have virtual directory concepts, or where you want to
> store the physical files somewhere else besides the actual document
> tree and have a proxy handler which serves them up. This is because
> req.filename is set based on what physical files Apache is able
> to identify and thus if the files are elsewhere or map to a virtual
> resource, it by itself doesn't help much. Thus, you still need to
> go off and do your own interpretation of req.path_info to identify
> the actual virtual resource.

yes, my folders are handling req.path_info recursively but i don't know 
how fake files for the file handlers. what do you recommend? to use a 
different Handler 'stage' (i.e. different that PythonHandler)?

> Anyway, that you feel you need to modify req.filename sounds like
> you have in mind a scheme like the WSGI middlware stack where
> middlware components can modify things like the script name and
> path info to reflect how much of the URI has been processed and
> also automatically remap it as necessary to support operation
> of nested middleware components. This componentised approach can
> certainly make it easier to implement more complex systems where
> there is a mix of physical and virtual resources. You might thus
> want to consider using WSGI on top of mod_python to make use of that
> top of model. Alternatively, I have been working on similar stuff
> for mod_python for a while, even before knowing that WSGI was doing
> a similar thing, but want I am doing is still in a slightly volatile
> state. If you are interested though, we can take the discussion
> off list.....

i have nothing serious written or designed yet, if you think i need WSGI 
lets go there :)

Alejandro Mery

More information about the Mod_python mailing list