##// END OF EJS Templates
hgweb: fix errors and warnings found by pychecker...
Benoit Boissinot -
r2394:a8f1049d default
parent child Browse files
Show More
@@ -591,7 +591,6 class hgweb(object):
591 591 count = cl.count()
592 592 start = max(0, count - self.maxchanges)
593 593 end = min(count, start + self.maxchanges)
594 pos = end - 1
595 594
596 595 yield self.t("summary",
597 596 desc = self.repo.ui.config("web", "description", "unknown"),
@@ -629,10 +628,10 class hgweb(object):
629 628 'zip': ('application/zip', 'zip', '.zip', None),
630 629 }
631 630
632 def archive(self, req, cnode, type):
631 def archive(self, req, cnode, type_):
633 632 reponame = re.sub(r"\W+", "-", os.path.basename(self.reponame))
634 633 name = "%s-%s" % (reponame, short(cnode))
635 mimetype, artype, extension, encoding = self.archive_specs[type]
634 mimetype, artype, extension, encoding = self.archive_specs[type_]
636 635 headers = [('Content-type', mimetype),
637 636 ('Content-disposition', 'attachment; filename=%s%s' %
638 637 (name, extension))]
@@ -649,7 +648,7 class hgweb(object):
649 648 def clean(path):
650 649 p = util.normpath(path)
651 650 if p[:2] == "..":
652 raise "suspicious path"
651 raise Exception("suspicious path")
653 652 return p
654 653
655 654 def header(**map):
@@ -804,11 +803,11 class hgweb(object):
804 803
805 804 elif cmd == 'archive':
806 805 changeset = self.repo.lookup(req.form['node'][0])
807 type = req.form['type'][0]
806 type_ = req.form['type'][0]
808 807 allowed = self.repo.ui.config("web", "allow_archive", "").split()
809 if (type in self.archives and (type in allowed or
810 self.repo.ui.configbool("web", "allow" + type, False))):
811 self.archive(req, changeset, type)
808 if (type_ in self.archives and (type_ in allowed or
809 self.repo.ui.configbool("web", "allow" + type_, False))):
810 self.archive(req, changeset, type_)
812 811 return
813 812
814 813 req.write(self.t("error"))
@@ -7,7 +7,7
7 7 # of the GNU General Public License, incorporated herein by reference.
8 8
9 9 from mercurial.demandload import demandload
10 demandload(globals(), "socket sys cgi os")
10 demandload(globals(), "socket sys cgi os errno")
11 11 from mercurial.i18n import gettext as _
12 12
13 13 class hgrequest(object):
General Comments 0
You need to be logged in to leave comments. Login now