Esempio n. 1
0
def view_party_rifcs(request, experiment_id):
    """View the rif-cs of an existing experiment.

    :param request: a HTTP Request instance
    :type request: :class:`django.http.HttpRequest`
    :param experiment_id: the ID of the experiment to be viewed
    :type experiment_id: string
    :rtype: :class:`django.http.HttpResponse`

    """
    try:
        experiment = Experiment.safe.get(request, experiment_id)
    except PermissionDenied:
        return return_response_error(request)
    except Experiment.DoesNotExist:
        return return_response_not_found(request)

    try:
        rifcs_provs = settings.RIFCS_PROVIDERS
    except AttributeError:
        rifcs_provs = ()

    from mecat.rifcs.publishservice import PartyPublishService
    pservice = PartyPublishService(rifcs_provs, experiment)
    context = pservice.get_context()
    if context is None:
        # return error page or something
        return return_response_error(request)
    
    template = pservice.get_template(type="party")
    return HttpResponse(render_response_index(request,
                        template, context), mimetype="text/xml")
Esempio n. 2
0
def _publish_public_expt_rifcs(experiment):
    try:
        providers = settings.RIFCS_PROVIDERS
    except:
        providers = None
    from mecat.rifcs.publishservice import PartyPublishService, CollectionPublishService
    # Handles party rifcs
    pservice = PartyPublishService(providers, experiment)
    pservice.manage_rifcs(settings.OAI_DOCS_PATH)
    # Handles dataset rifcs
    pservice = CollectionPublishService(providers, experiment)
    pservice.manage_rifcs(settings.OAI_DOCS_PATH)