Пример #1
0
def create_analysisrequest(container, **data):
    """Create a minimun viable AnalysisRequest

    :param container: A single folderish catalog brain or content object
    :type container: ATContentType/DexterityContentType/CatalogBrain
    """
    container = get_object(container)
    request = req.get_request()
    return create_ar(container, request, data)
Пример #2
0
def create_analysisrequest(container, **data):
    """Create a minimun viable AnalysisRequest

    :param container: A single folderish catalog brain or content object
    :type container: ATContentType/DexterityContentType/CatalogBrain
    """
    container = get_object(container)
    request = req.get_request()
    # we need to resolve the SampleType to a full object
    sample_type = data.get("SampleType", None)
    if sample_type is None:
        fail(400, "Please provide a SampleType")

    # TODO We should handle the same values as in the DataManager for this field
    #      (UID, path, objects, dictionaries ...)
    results = search(portal_type="SampleType", title=sample_type)

    values = {
        "Analyses": data.get("Analyses", []),
        "SampleType": results and get_object(results[0]) or None,
    }

    return create_ar(container, request, values)
Пример #3
0
def create_analysisrequest(container, **data):
    """Create a minimun viable AnalysisRequest

    :param container: A single folderish catalog brain or content object
    :type container: ATContentType/DexterityContentType/CatalogBrain
    """
    container = get_object(container)
    request = req.get_request()
    # we need to resolve the SampleType to a full object
    sample_type = data.get("SampleType", None)
    if sample_type is None:
        fail(400, "Please provide a SampleType")

    # TODO We should handle the same values as in the DataManager for this field
    #      (UID, path, objects, dictionaries ...)
    results = search(portal_type="SampleType", title=sample_type)

    values = {
        "Analyses": data.get("Analyses", []),
        "SampleType": results and get_object(results[0]) or None,
    }

    return create_ar(container, request, values)