Show More
@@ -94,6 +94,24 b' default = %s' | |||
|
94 | 94 | # pager =""", |
|
95 | 95 | } |
|
96 | 96 | |
|
97 | ||
|
98 | class httppasswordmgrdbproxy(object): | |
|
99 | """Delays loading urllib2 until it's needed.""" | |
|
100 | def __init__(self): | |
|
101 | self._mgr = None | |
|
102 | ||
|
103 | def _get_mgr(self): | |
|
104 | if self._mgr is None: | |
|
105 | self._mgr = urlreq.httppasswordmgrwithdefaultrealm() | |
|
106 | return self._mgr | |
|
107 | ||
|
108 | def add_password(self, *args, **kwargs): | |
|
109 | return self._get_mgr().add_password(*args, **kwargs) | |
|
110 | ||
|
111 | def find_user_password(self, *args, **kwargs): | |
|
112 | return self._get_mgr().find_user_password(*args, **kwargs) | |
|
113 | ||
|
114 | ||
|
97 | 115 | class ui(object): |
|
98 | 116 | def __init__(self, src=None): |
|
99 | 117 | """Create a fresh new ui object if no src given |
@@ -145,7 +163,7 b' class ui(object):' | |||
|
145 | 163 | # shared read-only environment |
|
146 | 164 | self.environ = encoding.environ |
|
147 | 165 | |
|
148 |
self.httppasswordmgrdb = |
|
|
166 | self.httppasswordmgrdb = httppasswordmgrdbproxy() | |
|
149 | 167 | |
|
150 | 168 | allowed = self.configlist('experimental', 'exportableenviron') |
|
151 | 169 | if '*' in allowed: |
@@ -172,7 +190,7 b' class ui(object):' | |||
|
172 | 190 | """Clear internal state that shouldn't persist across commands""" |
|
173 | 191 | if self._progbar: |
|
174 | 192 | self._progbar.resetstate() # reset last-print time of progress bar |
|
175 |
self.httppasswordmgrdb = |
|
|
193 | self.httppasswordmgrdb = httppasswordmgrdbproxy() | |
|
176 | 194 | |
|
177 | 195 | def formatter(self, topic, opts): |
|
178 | 196 | return formatter.formatter(self, topic, opts) |
General Comments 0
You need to be logged in to leave comments.
Login now