##// END OF EJS Templates
hgweb: move additional state setting outside of refresh...
Gregory Szorc -
r26160:952e0564 default
parent child Browse files
Show More
@@ -195,7 +195,7 class hgweb(object):
195 else:
195 else:
196 return repo.filtered('served')
196 return repo.filtered('served')
197
197
198 def refresh(self, request):
198 def refresh(self):
199 repostate = []
199 repostate = []
200 # file of interrests mtime and size
200 # file of interrests mtime and size
201 for meth, fname in foi:
201 for meth, fname in foi:
@@ -208,15 +208,11 class hgweb(object):
208 if repostate != self.repostate:
208 if repostate != self.repostate:
209 r = hg.repository(self.repo.baseui, self.repo.url())
209 r = hg.repository(self.repo.baseui, self.repo.url())
210 self.repo = self._getview(r)
210 self.repo = self._getview(r)
211 encoding.encoding = self.config("web", "encoding",
212 encoding.encoding)
213 # update these last to avoid threads seeing empty settings
211 # update these last to avoid threads seeing empty settings
214 self.repostate = repostate
212 self.repostate = repostate
215 # mtime is needed for ETag
213 # mtime is needed for ETag
216 self.mtime = st.st_mtime
214 self.mtime = st.st_mtime
217
215
218 self.repo.ui.environ = request.env
219
220 def run(self):
216 def run(self):
221 """Start a server from CGI environment.
217 """Start a server from CGI environment.
222
218
@@ -243,9 +239,13 class hgweb(object):
243 This is typically only called by Mercurial. External consumers
239 This is typically only called by Mercurial. External consumers
244 should be using instances of this class as the WSGI application.
240 should be using instances of this class as the WSGI application.
245 """
241 """
246 self.refresh(req)
242 self.refresh()
247 rctx = requestcontext(self)
243 rctx = requestcontext(self)
248
244
245 # This state is global across all threads.
246 encoding.encoding = rctx.config('web', 'encoding', encoding.encoding)
247 rctx.repo.ui.environ = req.env
248
249 # work with CGI variables to create coherent structure
249 # work with CGI variables to create coherent structure
250 # use SCRIPT_NAME, PATH_INFO and QUERY_STRING as well as our REPO_NAME
250 # use SCRIPT_NAME, PATH_INFO and QUERY_STRING as well as our REPO_NAME
251
251
General Comments 0
You need to be logged in to leave comments. Login now