diff mercurial/hgweb/hgweb_mod.py @ 2534:d5a3cc6520d5

Fix raw files in the web UI.
author Eric Hopper <hopper@omnifarious.org>
date Thu, 29 Jun 2006 18:34:26 -0700
parents 419c42223bee
children b8ccf6386db7
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -657,6 +657,12 @@ class hgweb(object):
             req.header(msg.items())
             yield header_file.read()
 
+        def rawfileheader(**map):
+            req.header([('Content-type', map['mimetype']),
+                        ('Content-disposition', 'filename=%s' % map['file']),
+                        ('Content-length', str(len(map['raw'])))])
+            yield ''
+
         def footer(**map):
             yield self.t("footer",
                          motd=self.repo.ui.config("web", "motd", ""),
@@ -714,6 +720,7 @@ class hgweb(object):
                                                "repo": self.reponame,
                                                "header": header,
                                                "footer": footer,
+                                               "rawfileheader": rawfileheader,
                                                })
 
         if not req.form.has_key('cmd'):