def removeFileAttachment(self): """ rimuove un file dal database """ if not self.doc.isReader(): return None if not (self.element and isfloat(self.element)): return None fileid = int(self.element) removeFile(self.doc, fileid)
def removeFileAttachment(self): """ rimuove un file dal database """ if not self.doc.isReader(): return None if not (self.element and isfloat(self.element)): return None fileid = int(self.element) removeFile(self.doc,fileid)
def getFileAttachment(self): """ carica un file dal database """ if not self.doc.isReader(): return None if not (self.element and isfloat(self.element)): return None fileid = int(self.element) dbfile = getFile(self.doc, fileid) if not dbfile: return None self.request.RESPONSE.setHeader("content-type", dbfile.file_type) self.request.RESPONSE.setHeader("Content-Disposition", "inline; filename=" + dbfile.file_name) return base64.b64decode(dbfile.file_content)
def getFileAttachment(self): """ carica un file dal database """ if not self.doc.isReader(): return None if not (self.element and isfloat(self.element)): return None fileid = int(self.element) dbfile = getFile(self.doc,fileid) if not dbfile: return None self.request.RESPONSE.setHeader( 'content-type', dbfile.file_type) self.request.RESPONSE.setHeader( "Content-Disposition", "inline; filename=" + dbfile.file_name) return base64.b64decode(dbfile.file_content)