File python-bugzilla-0.6.2-backtraces.patch of Package python-bugzilla
diff --git a/bugzilla/base.py b/bugzilla/base.py
index cfaea45..96a05d7 100644
--- a/bugzilla/base.py
+++ b/bugzilla/base.py
@@ -1050,7 +1050,22 @@ class CookieTransport(xmlrpclib.Transport):
else:
request = request_with_cookies # python 2.6 and earlier
-class SafeCookieTransport(xmlrpclib.SafeTransport,CookieTransport):
+class BasicAuthTransport(xmlrpclib.SafeTransport):
+ """A subclass of xmlrpclib.SafeTransport that allows setting HTTP Basic Auth
+ without exposing it as part of URL in backtraces."""
+ auth_params = None
+
+ def get_host_info(self, host):
+ host, extra_headers, x509 = xmlrpclib.Transport.get_host_info(self, host)
+ if isinstance(self.auth_params, tuple):
+ import base64
+ auth = base64.encodestring("%s:%s" % self.auth_params).strip()
+ if extra_headers is None:
+ extra_headers = []
+ extra_headers.append(("Authorization", "Basic " + auth))
+ return host, extra_headers, x509
+
+class SafeCookieTransport(BasicAuthTransport,CookieTransport):
'''SafeTransport subclass that supports cookies.'''
scheme = 'https'
# Override the appropriate request method
diff --git a/bugzilla/nvlbugzilla.py b/bugzilla/nvlbugzilla.py
index 7e2ec32..5804de4 100644
--- a/bugzilla/nvlbugzilla.py
+++ b/bugzilla/nvlbugzilla.py
@@ -39,8 +39,8 @@ class NovellBugzilla(Bugzilla34):
super(NovellBugzilla, self).__init__(**kwargs)
def _login(self, user, password):
- # using basic auth, so login happens implicitly at connect
- pass
+ # set up data for basic auth transport
+ self._transport.auth_params = (self.user, self.password)
def _logout(self):
# using basic auth, no logout
@@ -57,17 +57,9 @@ class NovellBugzilla(Bugzilla34):
if not hostname.startswith('api'):
hostname = 'api'+hostname
- self.readconfig()
- # set up basic auth url
- if self.user and self.password:
- hostname = self.user + ':' + self.password + '@' + hostname
-
# force https scheme (because of the basic auth)
url = urlparse.urlunsplit(('https', hostname, path, spliturl.query, spliturl.fragment))
- ret = super(NovellBugzilla, self).connect(url)
- # prevent our username+pass url from showing up in __repr__
- self.url = origurl
- return ret
+ return super(NovellBugzilla, self).connect(url)
@classmethod
def _read_osc_password(cls, c):