This is a resend to python-dev list of an email I sent yesterday. For some reason oaccsional email I am sending to list from home is dissappearing, although people cc'd it are getting it. Apologies if this is a duplicate.
On 30/01/2006, at 9:49 PM, Matt Carpenter wrote: > Graham Dumpleton wrote: >> Others may know what you are talking about, but I plead ignorance. >> Can >> you perhaps describe further what you are talking about, how it >> would be >> used etc. A URL to stuff that could be read to understand similar >> things >> would also help. >> >> Graham > What I am trying to achieve: > I'm writing a module for our system for managing documents that're > attached to records in our database, updates to these documents are > recorded into the database along with what user made the user that > made the edit, and various other information depending on what type > of document (the system manages templates, and mailmerges with > virtual .csv files pulling data from the database as well). The > directory structure is entirely virtual, the structure on the > servers is just a few directories for each type of file, and the > files are named after their record in the database. > mod_dav implements hooks (see http://mailman.lyra.org/pipermail/dav- > dev/2005-April/005926.html), but I'm not a C programmer, so I'd > like a these hooks to be able to call python functions instead. > Hope that makes sense. Regardless of how you might use it, from a technical standpoint I would say that it is not going to be possible at present. One could imagine being able to write a separate C based Apache module which provides Python based wrappings for the DAV specific data structures that the repository hook function use. As documented in: http://docx.webperf.org/structdav__hooks__repository.html But, there are a few things missing. First, is there is no way to obtain references to the Python interpreter instances held by mod_python, the mechanisms for creating them and acquiring locks against them from a distinct Apache module. Similarly, there is there is no way to access the mod_python Python request_rec wrapper object etc. Both of these and possibly other stuff would be required. You do not want to go having to duplicate all this stuff as it sort of defeats the purpose and would possibly prevent use of mod_python and your module in the same Apache instance. What would be an interesting area for investigation in the future would be to work out whether there are functions within the mod_python module which could be exposed using the Apache APR_RETRIEVE_OPTIONAL_FN() interface. This would allow distinct modules to dynamically obtain references to some of the internals of mod_python so as to perhaps make use of all the machinery it has already for manipulating Python interpreters, as well as existing Python object wrappers for Apache structures. The end result would be the ability to create distinct C based Apache modules which themselves can also make use of Python by bootstrapping of mod_python. It may be tricky to work out how to do it and come up with a good interface design, but certainly would be interesting. Graham