Rev 6239: (jelmer) Delay loading of the Kerberos module until it is actually used. in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/
Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Nov 4 13:57:33 UTC 2011
At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 6239 [merge]
revision-id: pqm at pqm.ubuntu.com-20111104135733-zx3l8f316wyk48ek
parent: pqm at pqm.ubuntu.com-20111102131727-qr5dgvmr33oh22yx
parent: jelmer at samba.org-20111104133007-1zyejzwb5w5qs22l
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2011-11-04 13:57:33 +0000
message:
(jelmer) Delay loading of the Kerberos module until it is actually used.
(Jelmer Vernooij)
modified:
bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
--- a/bzrlib/transport/http/_urllib2_wrappers.py 2011-09-03 16:30:53 +0000
+++ b/bzrlib/transport/http/_urllib2_wrappers.py 2011-11-04 13:30:07 +0000
@@ -48,12 +48,6 @@
import errno
import httplib
-try:
- import kerberos
-except ImportError:
- have_kerberos = False
-else:
- have_kerberos = True
import socket
import urllib
import urllib2
@@ -74,6 +68,10 @@
)
+checked_kerberos = False
+kerberos = None
+
+
class addinfourl(urllib2.addinfourl):
'''Replacement addinfourl class compatible with python-2.7's xmlrpclib
@@ -1325,7 +1323,14 @@
def _auth_match_kerberos(self, auth):
"""Try to create a GSSAPI response for authenticating against a host."""
- if not have_kerberos:
+ global kerberos, checked_kerberos
+ if kerberos is None and not checked_kerberos:
+ try:
+ import kerberos
+ except ImportError:
+ kerberos = None
+ checked_kerberos = True
+ if kerberos is None:
return None
ret, vc = kerberos.authGSSClientInit("HTTP@%(host)s" % auth)
if ret < 1:
More information about the bazaar-commits
mailing list