예제 #1
0
파일: File.py 프로젝트: poses/erp5
            return content_type, self.getData()

        elif format in VALID_TEXT_FORMAT_LIST:
            # This is acceptable to return empty string
            # for a File we can not convert
            return 'text/plain', ''
        raise NotImplementedError

    # backward compatibility
    security.declareProtected(Permissions.AccessContentsInformation,
                              'getFilename')

    def getFilename(self, default=_MARKER):
        """Fallback on getSourceReference as it was used
    before to store filename property
    """
        if self.hasFilename():
            if default is _MARKER:
                return self._baseGetFilename()
            else:
                return self._baseGetFilename(default)
        else:
            if default is _MARKER:
                return self._baseGetSourceReference()
            else:
                return self._baseGetSourceReference(default)


# CMFFile also brings the IContentishInterface on CMF 2.2, remove it.
removeIContentishInterface(File)
예제 #2
0
파일: File.py 프로젝트: smetsjp/erp5
    if format is None:
      # No conversion is asked,
      # we can return safely the file content itself
      return content_type, self.getData()
    elif format in VALID_TEXT_FORMAT_LIST:
      # This is acceptable to return empty string
      # for a File we can not convert
      return 'text/plain', ''
    raise NotImplementedError

  # backward compatibility
  security.declareProtected(Permissions.AccessContentsInformation, 'getFilename')
  def getFilename(self, default=_MARKER):
    """Fallback on getSourceReference as it was used
    before to store filename property
    """
    if self.hasFilename():
      if default is _MARKER:
        return self._baseGetFilename()
      else:
        return self._baseGetFilename(default)
    else:
      if default is _MARKER:
        return self._baseGetSourceReference()
      else:
        return self._baseGetSourceReference(default)

# CMFFile also brings the IContentishInterface on CMF 2.2, remove it.
removeIContentishInterface(File)