Apache Mod-Python - mod_python as a mod_dav backend

This is Interesting: Free IT Magazines  
Home > Archive > Apache Mod-Python > February 2006 > mod_python as a mod_dav backend





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author mod_python as a mod_dav backend
Matt Carpenter

2006-01-30, 7:48 am

Hi,
Not sure if this is best posted here, or to mod_dav mailing list. But
here goes.
Has anyone looked at using mod_python to backend mod_dav, with a similar
usage to FUSE's Python binding. Basically mod_dav_python.

Thanks,
Matt
--


Matt Carpenter

matt@fcpl.com <mailto:matt@fcpl.com>
------------------------------------------------------------------------
Evolve - Integrated Workflow for Recruitment <http://www.evolvedb.co.uk>


FCP Internet LTD

Unit 3, 52 Victoria Road,
Aldershot, Hampshire, GU11 1SS



tel: +44 (0) 1252 333 344
fax: +44 (0) 1252 333 348
efax <http://www.efax.co.uk/>: +44 (0) 8704 281 008



------------------------------------------------------------------------
This message is confidential; Any unauthorised disclosure, use or
dissemination, either whole or partial, is prohibited. If you are not
the intended recipient, please notify <mailto:info@evolvedb.co.uk> the
sender immediately and delete all copies of this message. Any views or
opinions presented are solely those of the author and do not necessarily
represent those of FCP Internet or its subsidiaries.

Matt Carpenter

2006-01-30, 7:48 am

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/d...ril/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.

Thanks,
Matt
--


Matt Carpenter

matt@fcpl.com <mailto:matt@fcpl.com>
------------------------------------------------------------------------
Evolve - Integrated Workflow for Recruitment <http://www.evolvedb.co.uk>


FCP Internet LTD

Unit 3, 52 Victoria Road,
Aldershot, Hampshire, GU11 1SS



tel: +44 (0) 1252 333 344
fax: +44 (0) 1252 333 348
efax <http://www.efax.co.uk/>: +44 (0) 8704 281 008



------------------------------------------------------------------------
This message is confidential; Any unauthorised disclosure, use or
dissemination, either whole or partial, is prohibited. If you are not
the intended recipient, please notify <mailto:info@evolvedb.co.uk> the
sender immediately and delete all copies of this message. Any views or
opinions presented are solely those of the author and do not necessarily
represent those of FCP Internet or its subsidiaries.

Graham Dumpleton

2006-01-30, 5:47 pm


On 30/01/2006, at 9:11 PM, Matt Carpenter wrote:

> Hi,
> Not sure if this is best posted here, or to mod_dav mailing list.
> But here goes.
> Has anyone looked at using mod_python to backend mod_dav, with a
> similar usage to FUSE's Python binding. Basically mod_dav_python.


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

Graham Dumpleton

2006-01-31, 6:33 pm

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:
> 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__...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

Graham Dumpleton

2006-01-31, 6:33 pm

And another one that seemed to vanish into thing air.

On 31/01/2006, at 10:11 PM, Matt Carpenter wrote:

>
>
> Graham Dumpleton wrote:
> How does mod_python hook into apache as it stands? Would it be
> conceivably possible to have mod_python itself create the
> dav_hooks_repository with a small patch to mod_python to provide a
> new Python*Handler?
> Apologies for the vagueness.. My knowledge of modular C programming
> is very sketchy.


It is technically possible to do it this way, ie., for mod_python to
register hooks for dav, but this is highly unlikely to be acceptable as
it means one is starting to lump into mod_python all this extra stuff
which has nothing to do with its core purpose. It would just make
things hard to maintain as for every mod_python release you then have
to test all that extra stuff as well.

If anything were to be done to allow working more closely with other
Apache modules, the far preferable approach is that I outlined. That way
mod_python has only to provide minimal generic module interface. All the
hard stuff is then external to mod_python in modules maintained by
other and doesn't impact development of mod_python itself.

Matt, can you please keep the discussion cc'd to the mailing list, as
probably of general interest.

Graham

Deron Meranda

2006-02-01, 5:48 pm

Actually it seems that this is yet another case of trying to get
mod_python to hook into more places in the Apache framework;
specifically to hook into other modules.

We've already been discussing specific-module hooks for

mod_ssl - http://issues.apache.org/jira/browse/MODPYTHON-94

mod_include - http://issues.apache.org/jira/browse/MODPYTHON-104

In fact there's a bit of potentially useful discussion in the notes
for those JIRA issues which is valid for any module-hooking in general
(along with this mailing list archives). I'd say it might be
worthwhile to at least create a new feature-request issue for mod_dav
hooks though; just so it's on the record.

BTW, even though it's not what you asked, it should be possible to
totally implement DAV using only the features already present in
mod_python (without mod_dav); but of course you're doing a lot of the
work yourself (but on the other hand you get to use Python rather than
C).
--
Deron Meranda

Graham Dumpleton

2006-02-01, 5:48 pm


On 02/02/2006, at 6:52 AM, Deron Meranda wrote:

> Actually it seems that this is yet another case of trying to get
> mod_python to hook into more places in the Apache framework;
> specifically to hook into other modules.
>
> We've already been discussing specific-module hooks for
>
> mod_ssl - http://issues.apache.org/jira/browse/MODPYTHON-94
>
> mod_include - http://issues.apache.org/jira/browse/MODPYTHON-104
>
> In fact there's a bit of potentially useful discussion in the notes
> for those JIRA issues which is valid for any module-hooking in general
> (along with this mailing list archives). I'd say it might be
> worthwhile to at least create a new feature-request issue for mod_dav
> hooks though; just so it's on the record.


Adding in support for mod_ssl and mod_include was reasonably trivial
and a natural fit for the basic functionality of mod_python.

Support for mod_dav development using Python would be a considerable
amount of work as it involves construction of a range of new Python
wrapper
classes for C structures and call in infrastructure for Python which
would be
quite tailored for that purpose. Having mod_dav support goes far
beyond the
basic charter of what mod_python is about and all this extra work
would be
an undue burden on core mod_python developers and cause even more
delays in any releases.

Thus why I see that you would be better of having a separate project for
a mod_dav_python module. There would still be changes required in
mod_python to allow the separate module to hook into the basic
infrastructure,
but this would be a more practical way of going about it and would also
allow other distinct modules besides mod_dav_python to be developed
which could have bindings for Python.

Graham


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com