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