84 return responses.get(code, ('Error', 'Unknown error'))[0] |
84 return responses.get(code, ('Error', 'Unknown error'))[0] |
85 |
85 |
86 def statusmessage(code, message=None): |
86 def statusmessage(code, message=None): |
87 return '%d %s' % (code, message or _statusmessage(code)) |
87 return '%d %s' % (code, message or _statusmessage(code)) |
88 |
88 |
89 def get_mtime(spath): |
89 def get_stat(spath): |
|
90 """stat changelog if it exists, spath otherwise""" |
90 cl_path = os.path.join(spath, "00changelog.i") |
91 cl_path = os.path.join(spath, "00changelog.i") |
91 if os.path.exists(cl_path): |
92 if os.path.exists(cl_path): |
92 return os.stat(cl_path).st_mtime |
93 return os.stat(cl_path) |
93 else: |
94 else: |
94 return os.stat(spath).st_mtime |
95 return os.stat(spath) |
|
96 |
|
97 def get_mtime(spath): |
|
98 return get_stat(spath).st_mtime |
95 |
99 |
96 def staticfile(directory, fname, req): |
100 def staticfile(directory, fname, req): |
97 """return a file inside directory with guessed Content-Type header |
101 """return a file inside directory with guessed Content-Type header |
98 |
102 |
99 fname always uses '/' as directory separator and isn't allowed to |
103 fname always uses '/' as directory separator and isn't allowed to |