def _save_file(self, file, stream): context = self.get_file_context() content_type = mimetypes.guess_type(file.filename)[0] or file.mimetype or 'application/octet-stream' f = File(filename=file.filename, content_type=content_type) f.save(context, stream) db.session.add(f) db.session.flush() logger.info('File %r uploaded (context: %r)', f, context) return FileSchema().jsonify(f), 201
def _process(self): return FileSchema().jsonify(self.file)
def _process(self): from indico.modules.files.schemas import FileSchema return FileSchema().jsonify(self.file)