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)
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)