def destroy(self): if not self.name: raise exception.ObjectActionError(action='destroy', reason='name is required') if not self.name.startswith(self.CUSTOM_NAMESPACE): raise exception.TraitCannotDeleteStandard(name=self.name) self._destroy_in_db(self._context, self.name)
def destroy(self): if not self.name: raise exception.ObjectActionError(action='destroy', reason='name is required') if not self.name.startswith(self.CUSTOM_NAMESPACE): raise exception.TraitCannotDeleteStandard(name=self.name) if self.id is None: raise exception.ObjectActionError(action='destroy', reason='ID attribute not found') self._destroy_in_db(self._context, self.id, self.name) self._context.trait_cache.clear()