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


Python File.index_html方法代码示例

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


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

示例1: viewOriginal

# 需要导入模块: from OFS.Image import File [as 别名]
# 或者: from OFS.Image.File import index_html [as 别名]
 def viewOriginal(self, REQUEST=None, RESPONSE=None, *args, **kwargs) :
   """ publish original pdf """
   pdf = File.index_html(self, REQUEST, RESPONSE, *args, **kwargs)
   RESPONSE.setHeader('Content-Type', 'application/pdf')
   RESPONSE.setHeader('Content-Disposition', 'inline;filename="%s.pdf"'
       % (self.title_or_id()))
   return pdf
开发者ID:Provab-Solutions,项目名称:erp5,代码行数:9,代码来源:PDFForm.py

示例2: index_html

# 需要导入模块: from OFS.Image import File [as 别名]
# 或者: from OFS.Image.File import index_html [as 别名]
 def index_html( self, REQUEST, RESPONSE ):
     """ Extends the file index_html to set the download filename.
     
     """
     filename = self.get_filename()
     REQUEST.RESPONSE.setHeader( 'Content-Disposition', 
                                'inline; filename="%s"' % filename )
     
     return File.index_html( self, REQUEST, RESPONSE )
开发者ID:groupserver,项目名称:Products.XWFPluggableFiles,代码行数:11,代码来源:XWFPluggableFile.py

示例3: index_html

# 需要导入模块: from OFS.Image import File [as 别名]
# 或者: from OFS.Image.File import index_html [as 别名]
    def index_html(self, REQUEST, RESPONSE):
        """ Override for File.index_html
        """
        # this is to deal with an acquisition issue, where
        # the context gets lost when .data is called
        bfd = self.get_baseFilesDir()
        if self._base_files_dir != bfd:
            self._base_files_dir = bfd

        return File.index_html(self, REQUEST, RESPONSE)
开发者ID:groupserver,项目名称:Products.XWFFileLibrary2,代码行数:12,代码来源:XWFFile2.py

示例4: some

# 需要导入模块: from OFS.Image import File [as 别名]
# 或者: from OFS.Image.File import index_html [as 别名]
     renderer = appy.pod.renderer.Renderer(**rendererParams)
     renderer.run()
 except appy.pod.PodError, pe:
     if not os.path.exists(tempFileName):
         # In some (most?) cases, when OO returns an error, the result is
         # nevertheless generated.
         raise PloneMeetingError(POD_ERROR % str(pe))
 # Open the temp file on the filesystem
 f = file(tempFileName, 'rb')
 if forBrowser:
     # Create a OFS.Image.File object that will manage correclty HTTP
     # headers, etc.
     from OFS.Image import File
     theFile = File('dummyId', 'dummyTitle', f,
                    content_type=mimeTypes[self.getPodFormat()])
     res = theFile.index_html(self.REQUEST, self.REQUEST.RESPONSE)
     # Before, I used the code below to set the HTTP headers.
     # But I've noticed that with some browsers (guess which one?) the
     # returned document could not be opened. Worse: the browser crashed
     # completely in some cases. So now I rely on File.index_html
     # instead. One caveat: the title of the file is "generateDocument-X'
     # and not a friendly title as before...
     #response = obj.REQUEST.RESPONSE
     #response.setHeader('Content-type', mimeTypes[self.getPodFormat()])
     #response.setHeader('Content-disposition',
     #                   'inline;filename="%s.%s"' % (
     #                       obj.Title(), self.getPodFormat()))
 else:
     # I must return the raw document content.
     res = f.read()
 f.close()
开发者ID:abdza,项目名称:PloneMeeting,代码行数:33,代码来源:PodTemplate.py


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