def handle_upload(self, dataset): prefix = '/'.join( (dataset.slug, datetime.now().strftime('%Y%m%d-%H%M%S'))) infos = handle_upload(storages.resources, prefix) if 'html' in infos['mime']: api.abort(415, 'Incorrect file content type: HTML') infos['title'] = os.path.basename(infos['filename']) infos['checksum'] = Checksum(type='sha1', value=infos.pop('sha1')) infos['filesize'] = infos.pop('size') del infos['filename'] return infos
def handle_upload(self, dataset): prefix = '/'.join((dataset.slug, datetime.now().strftime('%Y%m%d-%H%M%S'))) infos = handle_upload(storages.resources, prefix) if 'html' in infos['mime']: api.abort(415, 'Incorrect file content type: HTML') infos['title'] = os.path.basename(infos['filename']) infos['checksum'] = Checksum(type='sha1', value=infos.pop('sha1')) infos['filesize'] = infos.pop('size') del infos['filename'] return infos