##// END OF EJS Templates
avoid wsgiapplication <-> MercurialHTTPServer circular reference
Alexis S. L. Carvalho -
r4245:bd46b83b default
parent child Browse files
Show More
@@ -206,12 +206,17 b' def create_server(ui, repo):'
206 BaseHTTPServer.HTTPServer.__init__(self, *args, **kargs)
206 BaseHTTPServer.HTTPServer.__init__(self, *args, **kargs)
207 self.accesslog = accesslog
207 self.accesslog = accesslog
208 self.errorlog = errorlog
208 self.errorlog = errorlog
209 self.repo = repo
210 self.webdir_conf = webdir_conf
211 self.webdirmaker = hgwebdir
212 self.repoviewmaker = hgweb
213 self.reqmaker = wsgiapplication(self.make_handler)
214 self.daemon_threads = True
209 self.daemon_threads = True
210 def make_handler():
211 if webdir_conf:
212 hgwebobj = hgwebdir(webdir_conf, ui)
213 elif repo is not None:
214 hgwebobj = hgweb(hg.repository(repo.ui, repo.root))
215 else:
216 raise hg.RepoError(_("There is no Mercurial repository here"
217 " (.hg not found)"))
218 return hgwebobj
219 self.reqmaker = wsgiapplication(make_handler)
215
220
216 addr, port = self.socket.getsockname()[:2]
221 addr, port = self.socket.getsockname()[:2]
217 if addr in ('0.0.0.0', '::'):
222 if addr in ('0.0.0.0', '::'):
@@ -223,17 +228,6 b' def create_server(ui, repo):'
223 pass
228 pass
224 self.addr, self.port = addr, port
229 self.addr, self.port = addr, port
225
230
226 def make_handler(self):
227 if self.webdir_conf:
228 hgwebobj = self.webdirmaker(self.webdir_conf, ui)
229 elif self.repo is not None:
230 hgwebobj = self.repoviewmaker(hg.repository(repo.ui,
231 repo.root))
232 else:
233 raise hg.RepoError(_("There is no Mercurial repository here"
234 " (.hg not found)"))
235 return hgwebobj
236
237 class IPv6HTTPServer(MercurialHTTPServer):
231 class IPv6HTTPServer(MercurialHTTPServer):
238 address_family = getattr(socket, 'AF_INET6', None)
232 address_family = getattr(socket, 'AF_INET6', None)
239
233
General Comments 0
You need to be logged in to leave comments. Login now