mercurial/hgweb/hgweb_mod.py
changeset 36911 f0a851542a05
parent 36909 84110a1d0f7d
child 36920 6ff6e1d6b5b8
equal deleted inserted replaced
36910:98487ad0cf8b 36911:f0a851542a05
   288     def __call__(self, env, respond):
   288     def __call__(self, env, respond):
   289         """Run the WSGI application.
   289         """Run the WSGI application.
   290 
   290 
   291         This may be called by multiple threads.
   291         This may be called by multiple threads.
   292         """
   292         """
   293         req = requestmod.wsgirequest(env, respond)
   293         req = requestmod.parserequestfromenv(env)
   294         return self.run_wsgi(req)
   294         res = requestmod.wsgiresponse(req, respond)
   295 
   295 
   296     def run_wsgi(self, wsgireq):
   296         return self.run_wsgi(req, res)
       
   297 
       
   298     def run_wsgi(self, req, res):
   297         """Internal method to run the WSGI application.
   299         """Internal method to run the WSGI application.
   298 
   300 
   299         This is typically only called by Mercurial. External consumers
   301         This is typically only called by Mercurial. External consumers
   300         should be using instances of this class as the WSGI application.
   302         should be using instances of this class as the WSGI application.
   301         """
   303         """
   302         with self._obtainrepo() as repo:
   304         with self._obtainrepo() as repo:
   303             profile = repo.ui.configbool('profiling', 'enabled')
   305             profile = repo.ui.configbool('profiling', 'enabled')
   304             with profiling.profile(repo.ui, enabled=profile):
   306             with profiling.profile(repo.ui, enabled=profile):
   305                 for r in self._runwsgi(wsgireq, repo):
   307                 for r in self._runwsgi(req, res, repo):
   306                     yield r
   308                     yield r
   307 
   309 
   308     def _runwsgi(self, wsgireq, repo):
   310     def _runwsgi(self, req, res, repo):
   309         req = wsgireq.req
       
   310         res = wsgireq.res
       
   311         rctx = requestcontext(self, repo, req, res)
   311         rctx = requestcontext(self, repo, req, res)
   312 
   312 
   313         # This state is global across all threads.
   313         # This state is global across all threads.
   314         encoding.encoding = rctx.config('web', 'encoding')
   314         encoding.encoding = rctx.config('web', 'encoding')
   315         rctx.repo.ui.environ = req.rawenv
   315         rctx.repo.ui.environ = req.rawenv