def obj_create(self, bundle, request=None, **kwargs):
        """Oversee the creation of product and its required productversion.
        Probably not strictly RESTful.
        """
        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.")
        # pull the productversions off, they don't exist yet
        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))

        # create the product
        updated_bundle = super(ProductResource, self).obj_create(
            bundle=bundle, request=request, **kwargs)

        # create the productversions
        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