changeset 5982:b6bd4ee6ed85

move __del__ from httprepository to basehttphandler This should prevent the next patch from reopening an issue fixed by 0d94e4a3ddb4.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sun, 03 Feb 2008 21:03:46 -0200
parents ca2af0c81c9a
children 6f1fcbc58efa
files mercurial/httprepo.py
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/httprepo.py	Sun Feb 03 21:03:46 2008 -0200
+++ b/mercurial/httprepo.py	Sun Feb 03 21:03:46 2008 -0200
@@ -107,6 +107,9 @@
     def http_open(self, req):
         return self.do_open(httpconnection, req)
 
+    def __del__(self):
+        self.close_all()
+
 has_https = hasattr(urllib2, 'HTTPSHandler')
 if has_https:
     class httpsconnection(httplib.HTTPSConnection):
@@ -203,8 +206,7 @@
 
         proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy')
         # XXX proxyauthinfo = None
-        self.handler = httphandler()
-        handlers = [self.handler]
+        handlers = [httphandler()]
 
         if proxyurl:
             # proxy can be proper url or host[:port]
@@ -270,11 +272,6 @@
         opener.addheaders = [('User-agent', 'mercurial/proto-1.0')]
         urllib2.install_opener(opener)
 
-    def __del__(self):
-        if self.handler:
-            self.handler.close_all()
-            self.handler = None
-
     def url(self):
         return self.path