@transaction.commit_on_success
    def obj_create(self, bundle, request=None, **kwargs):
        """
        A generic version of creating a dns object. The strategy is simple: get
        bundle.data to the point where we call Class(**bundle.data) which
        creates an object. We then clean it and then save it. Finally we save
        any views that were in the bundle.
        """
        # Note, error_response() raises an ImmediateHttpResponse exception.
        # This should trigger transaction.commit_on_success to rollback what
        # happens in this function

        kv = self.extract_kv(bundle)
        # KV pairs should be saved after the object has been created
        if bundle.errors:
            self.error_response(bundle.errors, request)

        views = bundle.data.pop('views', [])
        comment = bundle.data.pop('comment', '')
        # views should be saved after the object has been created
        if bundle.errors:
            self.error_response(bundle.errors, request)

        bundle = self.full_hydrate(bundle)
        if bundle.errors:
            self.error_response(bundle.errors, request)

        # Create the Object
        try:
            self.apply_commit(bundle.obj, bundle.data)
        except (__HOLE__, TypeError), e:
            bundle.errors['error_messages'] = e.message
            self.error_response(bundle.errors, request)

        return self.save_commit(request, bundle, views, comment, kv)
dataset/ETHPy150Open mozilla/inventory/mozdns/api/v1/api.py/CommonDNSResource.obj_create