本文整理汇总了Python中cherrypy.lib.static.staticdir方法的典型用法代码示例。如果您正苦于以下问题:Python static.staticdir方法的具体用法?Python static.staticdir怎么用?Python static.staticdir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cherrypy.lib.static
的用法示例。
在下文中一共展示了static.staticdir方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handler
# 需要导入模块: from cherrypy.lib import static [as 别名]
# 或者: from cherrypy.lib.static import staticdir [as 别名]
def handler(self, *args, **kwargs):
"""Use this tool as a CherryPy page handler.
For example::
class Root:
nav = tools.staticdir.handler(section="/nav", dir="nav",
root=absDir)
"""
@expose
def handle_func(*a, **kw):
handled = self.callable(*args, **self._merged_args(kwargs))
if not handled:
raise cherrypy.NotFound()
return cherrypy.serving.response.body
return handle_func
示例2: handler
# 需要导入模块: from cherrypy.lib import static [as 别名]
# 或者: from cherrypy.lib.static import staticdir [as 别名]
def handler(self, *args, **kwargs):
"""Use this tool as a CherryPy page handler.
For example::
class Root:
nav = tools.staticdir.handler(section="/nav", dir="nav",
root=absDir)
"""
def handle_func(*a, **kw):
handled = self.callable(*args, **self._merged_args(kwargs))
if not handled:
raise cherrypy.NotFound()
return cherrypy.serving.response.body
handle_func.exposed = True
return handle_func
示例3: handler
# 需要导入模块: from cherrypy.lib import static [as 别名]
# 或者: from cherrypy.lib.static import staticdir [as 别名]
def handler(self, *args, **kwargs):
"""Use this tool as a CherryPy page handler.
For example::
class Root:
nav = tools.staticdir.handler(section="/nav", dir="nav",
root=absDir)
"""
def handle_func(*a, **kw):
handled = self.callable(*args, **self._merged_args(kwargs))
if not handled:
raise cherrypy.NotFound()
return cherrypy.serving.response.body
handle_func.exposed = True
return handle_func