def on_get(self, req, resp, filename):
suffix = os.path.splitext(req.path)[1]
resp.content_type = mimes.get(suffix, 'application/octet-stream')
filepath = os.path.join(ui_root, self.path, secure_filename(filename))
try:
resp.stream = open(filepath, 'rb')
resp.stream_len = os.path.getsize(filepath)
except IOError:
raise HTTPNotFound()
评论列表
文章目录