Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb.py @ 1792:a161c61ba8ed
Cleanup of tabs and coding when sending content type.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Wed, 22 Feb 2006 08:32:51 +0100 |
parents | 8a1f2eae2832 |
children | 83c6d8355909 |
comparison
equal
deleted
inserted
replaced
1791:1ed9e97d9d6d | 1792:a161c61ba8ed |
---|---|
1004 # generate ValueError manually | 1004 # generate ValueError manually |
1005 raise ValueError() | 1005 raise ValueError() |
1006 | 1006 |
1007 os.stat(fname) | 1007 os.stat(fname) |
1008 | 1008 |
1009 ct = mimetypes.guess_type(fname)[0] | 1009 ct = mimetypes.guess_type(fname)[0] or "text/plain" |
1010 if ct == None: | 1010 req.write("Content-type: %s\n\n" % ct, file(fname).read()) |
1011 ct = "text/plain" | |
1012 | |
1013 req.write("Content-type: " + ct + "\n\n" + file(fname).read()) | |
1014 except ValueError: | 1011 except ValueError: |
1015 # security breach attempt | 1012 # security breach attempt |
1016 req.write(self.t("error")) | 1013 req.write(self.t("error")) |
1017 except OSError, e: | 1014 except OSError, e: |
1018 if e.errno == errno.ENOENT: | 1015 if e.errno == errno.ENOENT: |