

def post(self, name):
    if (not may(CREATE)):
        raise Forbidden()
    f = request.files['file']
    if (not f):
        raise NotImplementedError
    content_range = ContentRange.from_request()
    with current_app.storage.openwrite(name) as item:
        if content_range:
            (size_written, _) = Upload.data(item, f, content_range.size, content_range.begin)
            file_hash = ''
            is_complete = content_range.is_complete
        else:
            f.seek(0, os.SEEK_END)
            size = f.tell()
            f.seek(0)
            (size_written, file_hash) = Upload.data(item, f, size)
            is_complete = True
        if is_complete:
            Upload.meta_complete(item, file_hash)
        result = jsonify({
            'files': [{
                'name': name,
                'filename': item.meta['filename'],
                'size': item.meta['size'],
                'url': '{0}#{1}'.format(url_for('bepasty.display', name=name), item.meta['filename']),
            }],
        })
    if (is_complete and (not file_hash)):
        background_compute_hash(current_app.storage, name)
    return result

dataset/ETHPy150Open bepasty/bepasty-server/bepasty/views/upload.py UploadContinueView.post/original