diff mercurial/url.py @ 9347:d0474b184347

url: add support for custom handlers in extensions
author Henrik Stuart <hg@hstuart.dk>
date Tue, 11 Aug 2009 22:45:38 +0200
parents a9eae2f3241c
children 4c041f1ee1b4
line wrap: on
line diff
--- 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