##// END OF EJS Templates
Pass a ui from create_server to hgwebdir and a repo from hgwebdir to hgweb...
Alexis S. L. Carvalho -
r4079:40c9710e default
parent child Browse files
Show More
@@ -16,10 +16,11 b' from mercurial.i18n import gettext as _'
16
16
17 # This is a stopgap
17 # This is a stopgap
18 class hgwebdir(object):
18 class hgwebdir(object):
19 def __init__(self, config):
19 def __init__(self, config, parentui=None):
20 def cleannames(items):
20 def cleannames(items):
21 return [(name.strip(os.sep), path) for name, path in items]
21 return [(name.strip(os.sep), path) for name, path in items]
22
22
23 self.parentui = parentui
23 self.motd = ""
24 self.motd = ""
24 self.style = ""
25 self.style = ""
25 self.repos_sorted = ('name', False)
26 self.repos_sorted = ('name', False)
@@ -73,6 +74,8 b' class hgwebdir(object):'
73 def motd(**map):
74 def motd(**map):
74 yield self.motd
75 yield self.motd
75
76
77 parentui = self.parentui or ui.ui(report_untrusted=False)
78
76 url = req.env['REQUEST_URI'].split('?')[0]
79 url = req.env['REQUEST_URI'].split('?')[0]
77 if not url.endswith('/'):
80 if not url.endswith('/'):
78 url += '/'
81 url += '/'
@@ -111,7 +114,7 b' class hgwebdir(object):'
111 rows = []
114 rows = []
112 parity = 0
115 parity = 0
113 for name, path in self.repos:
116 for name, path in self.repos:
114 u = ui.ui(report_untrusted=False)
117 u = ui.ui(parentui=parentui)
115 try:
118 try:
116 u.readconfig(os.path.join(path, '.hg', 'hgrc'))
119 u.readconfig(os.path.join(path, '.hg', 'hgrc'))
117 except IOError:
120 except IOError:
@@ -179,7 +182,8 b' class hgwebdir(object):'
179 if real:
182 if real:
180 req.env['REPO_NAME'] = virtual
183 req.env['REPO_NAME'] = virtual
181 try:
184 try:
182 hgweb(real).run_wsgi(req)
185 repo = hg.repository(parentui, real)
186 hgweb(repo).run_wsgi(req)
183 except IOError, inst:
187 except IOError, inst:
184 req.write(tmpl("error", error=inst.strerror))
188 req.write(tmpl("error", error=inst.strerror))
185 except hg.RepoError, inst:
189 except hg.RepoError, inst:
@@ -220,7 +220,7 b' def create_server(ui, repo):'
220
220
221 def make_handler(self):
221 def make_handler(self):
222 if self.webdir_conf:
222 if self.webdir_conf:
223 hgwebobj = self.webdirmaker(self.webdir_conf)
223 hgwebobj = self.webdirmaker(self.webdir_conf, ui)
224 elif self.repo is not None:
224 elif self.repo is not None:
225 hgwebobj = self.repoviewmaker(repo.__class__(repo.ui,
225 hgwebobj = self.repoviewmaker(repo.__class__(repo.ui,
226 repo.origroot))
226 repo.origroot))
General Comments 0
You need to be logged in to leave comments. Login now