@locked_function('inventory.record_lock')
    def save_commit(self, request, bundle, views, comment, kv):
        verb = "updated" if bundle.obj.pk else "created"
        error = None
        try:
            # obj's save() method should be calling full_clean()
            bundle.obj.save()
        except __HOLE__, e:
            error = json.dumps(e.message_dict)
        except Exception, e:
            error = "Please report this error: {0}".format(
                traceback.format_exc()
            )

        if error:
            bundle.errors['error_messages'] = error
            self.error_response(bundle.errors, request)

        reversion.set_comment(comment)
        if request.user.is_authenticated():
            reversion.set_user(request.user)

        try:
            self.update_views(bundle.obj, views)
            # Now do the kv magic
            if kv:
                bundle.obj.update_attrs()
                for k, v in kv:
                    setattr(bundle.obj.attrs, k, v)
        except ValidationError, e:
            bundle.data['error_messages'] = {'views': (
                "Some views failed validation with the message: {0}. "
                "The object was not" "{1}".format(e.messages[0], verb)
            )}
            self.error_response(bundle.errors, request)

        return bundle
dataset/ETHPy150Open mozilla/inventory/mozdns/api/v1/api.py/CommonDNSResource.save_commit