def export_files(self, dirname, nodeid): ''' Export the "content" property as a file, not csv column ''' source = self.db.filename(self.classname, nodeid) dest = self.exportFilename(dirname, nodeid) ensureParentsExist(dest) shutil.copyfile(source, dest)
def import_files(self, dirname, nodeid): ''' Import the "content" property as a file ''' source = self.exportFilename(dirname, nodeid) dest = self.db.filename(self.classname, nodeid, create=1) ensureParentsExist(dest) shutil.copyfile(source, dest) mime_type = None props = self.getprops() if props.has_key('type'): mime_type = self.get(nodeid, 'type') if not mime_type: mime_type = self.default_mime_type if props['content'].indexme: self.db.indexer.add_text((self.classname, nodeid, 'content'), self.get(nodeid, 'content'), mime_type)