Пример #1
0
 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
Пример #2
0
 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