def obj_create(self, bundle, request=None, **kwargs):
        """
        Manually create the proper results objects.

        This is necessary because we have special handler methods in
        RunCaseVersion for setting the statuses which we want to keep DRY.

        """
        request = request or bundle.request
        data = bundle.data.copy()

        try:
            status = data.pop("status")
            case = data.pop("case")
            env = Environment.objects.get(pk=data.get("environment"))
            run = data.pop("run_id")

        except __HOLE__ as e:
            raise ValidationError(
                "bad result object data missing key: {0}".format(e))

        except Environment.DoesNotExist as e:
            raise ValidationError(
                "Specified environment does not exist: {0}".format(e))


        data["environment"] = env

        try:
            rcv = RunCaseVersion.objects.get(
                run__id=run,
                caseversion__case__id=case,
                environments=env,
                )

        except RunCaseVersion.DoesNotExist as e:
            raise ValidationError(
                "RunCaseVersion not found for run: {0}, case: {1}, environment: {2}:\nError {3}".format(
                        str(run), str(case), str(env), e))

        self.authorized_create_detail([rcv], bundle)
        data["user"] = request.user

        method = rcv.get_result_method(status)
        bundle.obj = method(**data)
        return bundle
dataset/ETHPy150Open mozilla/moztrap/moztrap/model/execution/api.py/ResultResource.obj_create