當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。