def validate_absolute_path(self, root, absolute_path):
"""
Validate and return the absolute path.
Same behavior as parent StaticFileHandler class, except that
if the file is not found and does not have a file extension,
a file extension is appended to the filename and another
attempt is made to find the file.
"""
if (self.default_extension is not None and
not os.path.exists(absolute_path) and
os.path.splitext(absolute_path)[1] == '' and
os.path.exists(absolute_path + self.default_extension)):
# Append self.default_extension to extensionless file name.
absolute_path += self.default_extension
return super(ExtensionlessStaticFileHandler, self).validate_absolute_path(root, absolute_path)
extensionless_static_file_handler.py 文件源码
python
阅读 14
收藏 0
点赞 0
评论 0
评论列表
文章目录