本文整理汇总了Python中tornado.web.StaticFileHandler.get方法的典型用法代码示例。如果您正苦于以下问题:Python StaticFileHandler.get方法的具体用法?Python StaticFileHandler.get怎么用?Python StaticFileHandler.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tornado.web.StaticFileHandler
的用法示例。
在下文中一共展示了StaticFileHandler.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from tornado.web import StaticFileHandler [as 别名]
# 或者: from tornado.web.StaticFileHandler import get [as 别名]
def get(self, group, path):
logging.info("Request for %s file %s" % (group, path))
#check that requested file directory is in defined archives - note that group does not have the leading \ or / characters
if os.path.normpath(group).startswith(self.portal_rel_path):
self.root = self.portal_abs_path + os.path.sep
group = relativePath(group[len(self.portal_rel_path):])
elif os.path.normpath(group).startswith(self.report_rel_path):
self.root = self.report_abs_path + os.path.sep
group = relativePath(group[len(self.report_rel_path):])
else:
raise HTTPError(404, "Invalid file %s" % path)
path = os.path.join(group, path)
#disable caching or archive files
self.set_header("Cache-control", "no-cache")
StaticFileHandler.get(self, path, include_body=True)
示例2: get
# 需要导入模块: from tornado.web import StaticFileHandler [as 别名]
# 或者: from tornado.web.StaticFileHandler import get [as 别名]
def get(self, team, lang, task):
path = os.path.join(task, "by_team", "%s (%s).pdf" % (team, lang))
self.set_header("Content-Disposition", "attachment; filename=\"%s (%s, %s).pdf\"" % (task, lang, team))
StaticFileHandler.get(self, path)
示例3: get
# 需要导入模块: from tornado.web import StaticFileHandler [as 别名]
# 或者: from tornado.web.StaticFileHandler import get [as 别名]
def get(self, filename):
StaticFileHandler.get(self, filename)
示例4: get
# 需要导入模块: from tornado.web import StaticFileHandler [as 别名]
# 或者: from tornado.web.StaticFileHandler import get [as 别名]
def get(self):
StaticFileHandler.get(self,
self.controllers[Resource].scripts_file_name)