comparison mercurial/hgweb/common.py @ 13959:141f88ae5276

merge with stable
author Martin Geisler <mg@lazybytes.net>
date Tue, 19 Apr 2011 15:19:54 +0200
parents 19f8629ea107 71f51cc71652
children 3233b39d756f
comparison
equal deleted inserted replaced
13956:ffb5c09ba822 13959:141f88ae5276
103 return responses.get(code, ('Error', 'Unknown error'))[0] 103 return responses.get(code, ('Error', 'Unknown error'))[0]
104 104
105 def statusmessage(code, message=None): 105 def statusmessage(code, message=None):
106 return '%d %s' % (code, message or _statusmessage(code)) 106 return '%d %s' % (code, message or _statusmessage(code))
107 107
108 def get_mtime(spath): 108 def get_stat(spath):
109 """stat changelog if it exists, spath otherwise"""
109 cl_path = os.path.join(spath, "00changelog.i") 110 cl_path = os.path.join(spath, "00changelog.i")
110 if os.path.exists(cl_path): 111 if os.path.exists(cl_path):
111 return os.stat(cl_path).st_mtime 112 return os.stat(cl_path)
112 else: 113 else:
113 return os.stat(spath).st_mtime 114 return os.stat(spath)
115
116 def get_mtime(spath):
117 return get_stat(spath).st_mtime
114 118
115 def staticfile(directory, fname, req): 119 def staticfile(directory, fname, req):
116 """return a file inside directory with guessed Content-Type header 120 """return a file inside directory with guessed Content-Type header
117 121
118 fname always uses '/' as directory separator and isn't allowed to 122 fname always uses '/' as directory separator and isn't allowed to