def derive_dataset(request, slug):
    user = authorize(request)

    title = request.REQUEST.get('title', 'Untitled dataset')
    parent_dataresource=slug

    if 'parent_page' in request.REQUEST:
        parent_page = Page.objects.get(slug=request.REQUEST['parent_page'])
        authorize(request, parent_page, add=True)
    else:
        parent_page = get_data_page_for_user(request.user)

    parent_dataresource = DataResource.objects.get(slug=parent_dataresource)
    authorize(request, parent_dataresource, view=True)

    ds = SpatialiteDriver.derive_dataset(
        title=title,
        parent_page=parent_page,
        parent_dataresource=parent_dataresource,
        owner=request.user
    )

    dispatch.api_accessed.send(sender=DataResource, instance=ds, user=user)
    dispatch.dataset_created.send(sender=DataResource, instance=ds, user=user)
    return json_or_jsonp(request, {'path': ds.slug}, code=201)
dataset/ETHPy150Open hydroshare/hydroshare2/ga_resources/views/rest_data.py/derive_dataset/original