Your message dated Tue, 29 Apr 2008 23:36:01 +0100
with message-id <[EMAIL PROTECTED]>
and subject line python-davlib has been removed from Debian, closing #425947
has caused the Debian Bug report #425947,
regarding python-davlib: inconsistent use of kwargs
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [EMAIL PROTECTED]
immediately.)


-- 
425947: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=425947
Debian Bug Tracking System
Contact [EMAIL PROTECTED] with problems
--- Begin Message ---
Package: python-davlib
Version: 1.8-4

Hi,

It seems to me that the HTTPConnectionAuth class doesn't actually
implement authorization, despite its name and methods. You can work
around this using extra_hdrs which includes an 'Authorization' header,
but because of the inconsistent use of kwargs in the DAV class, this
can be problematic. For instance, you may think, "I will write a class
like this:"

class dav(davlib.DAV):
    def __init__(self):
        davlib.DAV.__init__(self, HOST, PORT)
        self.extra_hdrs = {'Authorization': 'Basic ' +
b64encode(USERNAME + ':' + PASSWORD)}

    def _request(self, method, url, *rest, **kw):
        kw.setdefault('extra_hdrs', {}).update(self.extra_hdrs)
        response = parentDAV._request(self, method, url, *rest, **kw)
        return response

But this will fail if you call one of the random methods in the DAV
class (like 'put', but not 'mkcol') which uses positional arguments to
specify extra headers. Since the DAV class uses positional arguments
and kwargs inconsistently, there's no easy, elegant solution.

Attached is a patch that uses kwargs for all extra_hdrs in internal
calls to _request. Please apply.

Ethan
--- /usr/lib/python2.4/site-packages/davlib.py	2006-06-16 16:43:03.000000000 -0400
+++ davlib.py	2007-05-24 23:17:16.000000000 -0400
@@ -161,7 +161,7 @@
       body = body[1:]
       headers['Content-Type'] = 'application/x-www-form-urlencoded'
 
-    return self._request('POST', url, body, headers)
+    return self._request('POST', url, body, extra_hdrs=headers)
 
   def options(self, url='*', extra_hdrs={ }):
     return self._request('OPTIONS', url, extra_hdrs=extra_hdrs)
@@ -180,7 +180,7 @@
       headers['Content-Type'] = content_type
     if content_enc:
       headers['Content-Encoding'] = content_enc
-    return self._request('PUT', url, contents, headers)
+    return self._request('PUT', url, contents, extra_hdrs=headers)
 
   def delete(self, url, extra_hdrs={ }):
     return self._request('DELETE', url, extra_hdrs=extra_hdrs)
@@ -190,12 +190,12 @@
     headers['Content-Type'] = XML_CONTENT_TYPE
     if depth is not None:
       headers['Depth'] = str(depth)
-    return self._request('PROPFIND', url, body, headers)
+    return self._request('PROPFIND', url, body, extra_hdrs=headers)
 
   def proppatch(self, url, body, extra_hdrs={ }):
     headers = extra_hdrs.copy()
     headers['Content-Type'] = XML_CONTENT_TYPE
-    return self._request('PROPPATCH', url, body, headers)
+    return self._request('PROPPATCH', url, body, extra_hdrs=headers)
 
   def mkcol(self, url, extra_hdrs={ }):
     return self._request('MKCOL', url, extra_hdrs=extra_hdrs)

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---
--- Begin Message ---
Version: 1.8-4+rm

The python-davlib package has been removed from Debian testing, unstable and
experimental, so I am now closing the bugs that were still opened
against it.

For more information about this package's removal, read
http://bugs.debian.org/468660 . That bug might give the reasons why
this package was removed, and suggestions of possible replacements.

Don't hesitate to reply to this mail if you have any question.

Thank you for your contribution to Debian.

--
Marco Rodrigues
http://Marco.Tondela.org


--- End Message ---

Reply via email to