

def obj_create(self, bundle, request=None, **kwargs):
    'Oversee the creation of product and its required productversion.\n        Probably not strictly RESTful.\n        '
    request = (request or bundle.request)
    pv_required_msg = str((("The 'productversions' key must exist, " + 'must be a list, and the list must contain ') + 'at least one entry.'))
    try:
        productversions = bundle.data.pop('productversions')
        if (not isinstance(productversions, list)):
            raise ImmediateHttpResponse(response=http.HttpBadRequest(pv_required_msg))
        if (not len(productversions)):
            raise ImmediateHttpResponse(response=http.HttpBadRequest(pv_required_msg))
        bundle.data['productversions'] = []
    except KeyError:
        raise ImmediateHttpResponse(response=http.HttpBadRequest(pv_required_msg))
    updated_bundle = super(ProductResource, self).obj_create(bundle=bundle, request=request, **kwargs)
    for pv in productversions:
        ProductVersion.objects.get_or_create(product=updated_bundle.obj, **pv)
    return updated_bundle

dataset/ETHPy150Open mozilla/moztrap/moztrap/model/core/api.py ProductResource.obj_create/original