mercurial/hgweb/common.py
changeset 30636 f1c9fafcbf46
parent 30625 bcf4a975f93d
child 30766 d7bf7d2bd5ab
equal deleted inserted replaced
30635:a150173da1c1 30636:f1c9fafcbf46
    11 import errno
    11 import errno
    12 import mimetypes
    12 import mimetypes
    13 import os
    13 import os
    14 
    14 
    15 from .. import (
    15 from .. import (
       
    16     encoding,
    16     pycompat,
    17     pycompat,
    17     util,
    18     util,
    18 )
    19 )
    19 
    20 
    20 httpserver = util.httpserver
    21 httpserver = util.httpserver
   189     web.contact is the primary source, but if that is not set, try
   190     web.contact is the primary source, but if that is not set, try
   190     ui.username or $EMAIL as a fallback to display something useful.
   191     ui.username or $EMAIL as a fallback to display something useful.
   191     """
   192     """
   192     return (config("web", "contact") or
   193     return (config("web", "contact") or
   193             config("ui", "username") or
   194             config("ui", "username") or
   194             os.environ.get("EMAIL") or "")
   195             encoding.environ.get("EMAIL") or "")
   195 
   196 
   196 def caching(web, req):
   197 def caching(web, req):
   197     tag = 'W/"%s"' % web.mtime
   198     tag = 'W/"%s"' % web.mtime
   198     if req.env.get('HTTP_IF_NONE_MATCH') == tag:
   199     if req.env.get('HTTP_IF_NONE_MATCH') == tag:
   199         raise ErrorResponse(HTTP_NOT_MODIFIED)
   200         raise ErrorResponse(HTTP_NOT_MODIFIED)