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


Python File.manage_upload方法代码示例

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


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

示例1: manage_upload

# 需要导入模块: from OFS.Image import File [as 别名]
# 或者: from OFS.Image.File import manage_upload [as 别名]
  def manage_upload(self, file=None, REQUEST=None) :
    """ Zope calls this when the content of the enclosed file changes.
    The 'cells' attribute is updated, but already defined cells are not
    erased, they are saved in the 'all_cells' attribute so if the pdf
    file is reverted, you do not loose the cells definitions.
    """
    if not file or not hasattr(file, "read") :
      raise ValueError ("The pdf form file should not be empty")

    file.seek(0) # file is always valid here
    values = PDFTk().dumpDataFields(file)
    self.cells = {}
    for v in values :
      if v["FieldType"] not in ("Button", "Choice")\
                    or not int(v["FieldFlags"]) & 65536:
        k = v["FieldName"]
        if not self.all_cells.has_key(k) :
          self.cells[k] = ""
        else :
          self.cells[k] = self.all_cells[k]
    self.all_cells.update(self.cells)
    file.seek(0)
    File.manage_upload(self, file, REQUEST)
    if REQUEST:
      message = "Saved changes."
      return self.manage_main(self, REQUEST, manage_tabs_message=message)
开发者ID:Provab-Solutions,项目名称:erp5,代码行数:28,代码来源:PDFForm.py

示例2: manage_upload

# 需要导入模块: from OFS.Image import File [as 别名]
# 或者: from OFS.Image.File import manage_upload [as 别名]
 def manage_upload( self, file='', REQUEST=None ):
     """ This overrided the manage_upload provided by the File class
     to add a hook for setting the original filename.
     
     """
     LOG('XWFPluggableFile1.1',INFO,str(dir(file)))
     File.manage_upload( self, file )
     
     filename = getattr( file, 'filename', '' )
     filename = convertTextToAscii( removePathsFromFilenames( filename ) )
     
     self.filename = filename
     self.manage_changeProperties(original_filename=filename)\
     
     if REQUEST:
         message="Saved changes."
         return self.manage_main( self, REQUEST, manage_tabs_message=message )
开发者ID:groupserver,项目名称:Products.XWFPluggableFiles,代码行数:19,代码来源:XWFPluggableFile.py


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