mercurial/hgweb/hgweb_mod.py
changeset 5928 3340aa5a64f7
parent 5923 f39110afc039
child 5930 c301f15c965a
equal deleted inserted replaced
5927:b06c56f8fab7 5928:3340aa5a64f7
     4 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
     4 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
     5 #
     5 #
     6 # This software may be used and distributed according to the terms
     6 # This software may be used and distributed according to the terms
     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 import os, mimetypes, re, mimetools, cStringIO
     9 import os, mimetypes, re
    10 from mercurial.node import *
    10 from mercurial.node import *
    11 from mercurial import mdiff, ui, hg, util, archival, patch, hook
    11 from mercurial import mdiff, ui, hg, util, archival, patch, hook
    12 from mercurial import revlog, templater
    12 from mercurial import revlog, templater
    13 from common import ErrorResponse, get_mtime, style_map, paritygen, get_contact
    13 from common import ErrorResponse, get_mtime, style_map, paritygen, get_contact
    14 from request import wsgirequest
    14 from request import wsgirequest
   251             staticurl += '/'
   251             staticurl += '/'
   252 
   252 
   253         # some functions for the templater
   253         # some functions for the templater
   254 
   254 
   255         def header(**map):
   255         def header(**map):
   256             header_file = cStringIO.StringIO(
   256             ctype = tmpl('mimetype', encoding=self.encoding)
   257                 ''.join(tmpl("header", encoding=self.encoding, **map)))
   257             req.httphdr(templater.stringify(ctype))
   258             msg = mimetools.Message(header_file, 0)
   258             yield tmpl('header', encoding=self.encoding, **map)
   259             req.header(msg.items())
       
   260             yield header_file.read()
       
   261 
   259 
   262         def footer(**map):
   260         def footer(**map):
   263             yield tmpl("footer", **map)
   261             yield tmpl("footer", **map)
   264 
   262 
   265         def motd(**map):
   263         def motd(**map):