mercurial/hgweb/hgwebdir_mod.py
changeset 36865 3d60a22e27f5
parent 36863 1a1972b1a1ff
child 36873 98baf8dea553
equal deleted inserted replaced
36864:4e06e8336634 36865:3d60a22e27f5
   227         with profiling.profile(self.ui, enabled=profile):
   227         with profiling.profile(self.ui, enabled=profile):
   228             for r in self._runwsgi(wsgireq):
   228             for r in self._runwsgi(wsgireq):
   229                 yield r
   229                 yield r
   230 
   230 
   231     def _runwsgi(self, wsgireq):
   231     def _runwsgi(self, wsgireq):
       
   232         req = wsgireq.req
       
   233 
   232         try:
   234         try:
   233             self.refresh()
   235             self.refresh()
   234 
   236 
   235             csp, nonce = cspvalues(self.ui)
   237             csp, nonce = cspvalues(self.ui)
   236             if csp:
   238             if csp:
   240             tmpl = self.templater(wsgireq, nonce)
   242             tmpl = self.templater(wsgireq, nonce)
   241             ctype = tmpl('mimetype', encoding=encoding.encoding)
   243             ctype = tmpl('mimetype', encoding=encoding.encoding)
   242             ctype = templater.stringify(ctype)
   244             ctype = templater.stringify(ctype)
   243 
   245 
   244             # a static file
   246             # a static file
   245             if virtual.startswith('static/') or 'static' in wsgireq.form:
   247             if virtual.startswith('static/') or 'static' in req.qsparams:
   246                 if virtual.startswith('static/'):
   248                 if virtual.startswith('static/'):
   247                     fname = virtual[7:]
   249                     fname = virtual[7:]
   248                 else:
   250                 else:
   249                     fname = wsgireq.form['static'][0]
   251                     fname = req.qsparams['static']
   250                 static = self.ui.config("web", "static", None,
   252                 static = self.ui.config("web", "static", None,
   251                                         untrusted=False)
   253                                         untrusted=False)
   252                 if not static:
   254                 if not static:
   253                     tp = self.templatepath or templater.templatepaths()
   255                     tp = self.templatepath or templater.templatepaths()
   254                     if isinstance(tp, str):
   256                     if isinstance(tp, str):
   469                 yield row
   471                 yield row
   470 
   472 
   471         self.refresh()
   473         self.refresh()
   472         sortable = ["name", "description", "contact", "lastchange"]
   474         sortable = ["name", "description", "contact", "lastchange"]
   473         sortcolumn, descending = sortdefault
   475         sortcolumn, descending = sortdefault
   474         if 'sort' in wsgireq.form:
   476         if 'sort' in wsgireq.req.qsparams:
   475             sortcolumn = wsgireq.form['sort'][0]
   477             sortcolum = wsgireq.req.qsparams['sort']
   476             descending = sortcolumn.startswith('-')
   478             descending = sortcolumn.startswith('-')
   477             if descending:
   479             if descending:
   478                 sortcolumn = sortcolumn[1:]
   480                 sortcolumn = sortcolumn[1:]
   479             if sortcolumn not in sortable:
   481             if sortcolumn not in sortable:
   480                 sortcolumn = ""
   482                 sortcolumn = ""