url: add support for custom handlers in extensions
authorHenrik Stuart <hg@hstuart.dk>
Tue, 11 Aug 2009 22:45:38 +0200
changeset 9347 d0474b184347
parent 9346 bb3f8f692bc6
child 9348 954f7a879495
url: add support for custom handlers in extensions
mercurial/url.py
--- a/mercurial/url.py	Wed Jul 15 11:26:47 2009 +0900
+++ b/mercurial/url.py	Tue Aug 11 22:45:38 2009 +0200
@@ -487,6 +487,8 @@
         authinfo = None
     return url, authinfo
 
+handlerfuncs = []
+
 def opener(ui, authinfo=None):
     '''
     construct an opener suitable for urllib2
@@ -507,6 +509,7 @@
 
     handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr),
                      httpdigestauthhandler(passmgr)))
+    handlers.extend([h(ui, passmgr) for h in handlerfuncs])
     opener = urllib2.build_opener(*handlers)
 
     # 1.0 here is the _protocol_ version