当前位置: 首页>>代码示例>>Python>>正文


Python File.isLeaf方法代码示例

本文整理汇总了Python中twisted.web.static.File.isLeaf方法的典型用法代码示例。如果您正苦于以下问题:Python File.isLeaf方法的具体用法?Python File.isLeaf怎么用?Python File.isLeaf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.web.static.File的用法示例。


在下文中一共展示了File.isLeaf方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: download_zip

# 需要导入模块: from twisted.web.static import File [as 别名]
# 或者: from twisted.web.static.File import isLeaf [as 别名]
    def download_zip(self, request, request_id):
        download = yield self.download_database.get_download(
            self.logger, request_id=request_id
        )
        assert download.completed

        self.logger.bind(
            request_id=request_id,
            file_number=download.file_number,
        ).emit("download")

        document_types = yield self.document_types.wait()
        path = download.build_zip(self.jinja_env, self.fernet, document_types)

        request.setHeader(
            "Content-Disposition",
            "attachment; filename={}-eFolder.zip".format(download.file_number)
        )

        resource = File(path, defaultType="application/zip")
        resource.isLeaf = True

        request.notifyFinish().addBoth(lambda *args, **kwargs: os.remove(path))

        returnValue(resource)
开发者ID:department-of-veterans-affairs,项目名称:efolder-express,代码行数:27,代码来源:app.py

示例2: getChild

# 需要导入模块: from twisted.web.static import File [as 别名]
# 或者: from twisted.web.static.File import isLeaf [as 别名]
 def getChild(self, name, request):
     #make source media available via oshash
     if request.path.startswith('/get/'):
         oshash = request.path.split('/')[-1]
         for path in self.client.path(oshash):
             if os.path.exists(path):
                 f = File(path, 'application/octet-stream')
                 f.isLeaf = True
                 return f
     return self
开发者ID:wafaa-yousef88,项目名称:pandora_client_image_private,代码行数:12,代码来源:server.py

示例3: getFile

# 需要导入模块: from twisted.web.static import File [as 别名]
# 或者: from twisted.web.static.File import isLeaf [as 别名]
    def getFile(self, request, transferId, *args):
        """
        Get the file objects located at transfer id.
        """
        transfer = self._outboundRequests.get(transferId)

        if transfer is None:
            return NoResource()

        rootpath = filepath.FilePath(transfer.filenameBytes())

        if rootpath.isdir():
            return File(rootpath.dirname())

        if rootpath.isfile():
            file = File(rootpath.path)
            file.isLeaf = True
            return file
开发者ID:derwolfe,项目名称:teiler,代码行数:20,代码来源:server.py

示例4: static

# 需要导入模块: from twisted.web.static import File [as 别名]
# 或者: from twisted.web.static.File import isLeaf [as 别名]
def static(request):
    file = File("./staticfile.txt")
    file.isLeaf = True
    return file
开发者ID:derwolfe,项目名称:kleintest,代码行数:6,代码来源:main.py

示例5: index

# 需要导入模块: from twisted.web.static import File [as 别名]
# 或者: from twisted.web.static.File import isLeaf [as 别名]
 def index(_):
     index_path = os.path.join(self.root_path, 'templates', 'index.html')
     print index_path
     f = File(index_path)
     f.isLeaf = True
     return f
开发者ID:KurlesHS,项目名称:twised_angular_test,代码行数:8,代码来源:app.py


注:本文中的twisted.web.static.File.isLeaf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。