Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/webcommands.py @ 18347:853221386f48
hgweb: make type a mandatory parameter to request.respond
There will thus always be headers and the runtime check can be removed.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Tue, 15 Jan 2013 01:05:12 +0100 |
parents | e350ce798b63 |
children | 764a758780b6 |
comparison
equal
deleted
inserted
replaced
18346:6c2563b2c1c6 | 18347:853221386f48 |
---|---|
798 if cnode == key or key == 'tip': | 798 if cnode == key or key == 'tip': |
799 arch_version = short(cnode) | 799 arch_version = short(cnode) |
800 name = "%s-%s" % (reponame, arch_version) | 800 name = "%s-%s" % (reponame, arch_version) |
801 mimetype, artype, extension, encoding = web.archive_specs[type_] | 801 mimetype, artype, extension, encoding = web.archive_specs[type_] |
802 headers = [ | 802 headers = [ |
803 ('Content-Type', mimetype), | |
804 ('Content-Disposition', 'attachment; filename=%s%s' % (name, extension)) | 803 ('Content-Disposition', 'attachment; filename=%s%s' % (name, extension)) |
805 ] | 804 ] |
806 if encoding: | 805 if encoding: |
807 headers.append(('Content-Encoding', encoding)) | 806 headers.append(('Content-Encoding', encoding)) |
808 req.header(headers) | 807 req.header(headers) |
809 req.respond(HTTP_OK) | 808 req.respond(HTTP_OK, mimetype) |
810 | 809 |
811 ctx = webutil.changectx(web.repo, req) | 810 ctx = webutil.changectx(web.repo, req) |
812 archival.archive(web.repo, req, cnode, artype, prefix=name, | 811 archival.archive(web.repo, req, cnode, artype, prefix=name, |
813 matchfn=scmutil.match(ctx, []), | 812 matchfn=scmutil.match(ctx, []), |
814 subrepos=web.configbool("web", "archivesubrepos")) | 813 subrepos=web.configbool("web", "archivesubrepos")) |