[Tutor] Davlib and HTTP Authentication

Rik Wade rik at rikwade.com
Mon May 23 13:48:12 CEST 2005


Would anyone on the list with some knowledge of working with  
davlib.py (http://www.lyra.org/greg/python/) be able to advise  
regarding use of the library with a Dav server (apache2 with mod_dav)  
that is configured to require HTTP Basic Authentication?

Specifically, I have calls for davlib.put, which look like:

     mydav.put(myurl,mydata,None,None,{"Authorization":"Basic %s"%auth})

where davlib.put is defined as:

     def put(self, url, contents, content_type=None,  
content_enc=None, extra_hdrs={ }):

The put functions work fine, as do some other basic Dav functions  
which are defined in a similar manner
.

However, I would like to manipulate the properties of files on the  
server. The "user" function defined in davlib is:

     def setprops(self, url, *xmlprops, **props):

which doesn't appear to permit the addition of extra_hdrs as before  
in order to carry out HTTP Basic Authentication. There is, however, a  
proppatch function defined as:

     def proppatch(self, url, body, extra_hdrs={ }):

which does not have some of the XML parsing and formatting that  
occurs in setprops.

I am wondering whether I should be implementing my own setprops  
function, perhaps inheriting and extending from the davlib class,  
whether I should be writing my own setprops function from scratch, or  
whether I should just use the proppatch function. Davlib.py isn't  
very well documented.

So in generic terms, the question is "I am using a library but the  
function doesn't appear to do what I need it to, what's the best way  
to proceed?".

Many thanks,
--
rik

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/tutor/attachments/20050523/19293e78/PGP.pgp


More information about the Tutor mailing list