示例#1
0
 def _get_goal(self, context, fieldname, value, eager):
     try:
         return self._get(context,
                          model=models.Goal,
                          fieldname=fieldname,
                          value=value,
                          eager=eager)
     except exception.ResourceNotFound:
         raise exception.GoalNotFound(goal=value)
示例#2
0
    def get_goal_uuid(cls, uuid_or_name):
        if uuid_or_name is None:
            return

        query_func = None
        if not utils.is_uuid_like(uuid_or_name):
            query_func = objects.Goal.get_by_name
        else:
            query_func = objects.Goal.get_by_uuid

        try:
            goal = query_func(cls.ctx, uuid_or_name)
        except Exception as exc:
            LOG.exception(exc)
            raise exception.GoalNotFound(goal=uuid_or_name)

        if not goal.deleted_at:
            raise exception.NotSoftDeletedStateError(name=_('Goal'),
                                                     id=uuid_or_name)

        return goal.uuid
示例#3
0
文件: api.py 项目: crowdy/watcher
 def soft_delete_goal(self, goal_id):
     try:
         return self._soft_delete(models.Goal, goal_id)
     except exception.ResourceNotFound:
         raise exception.GoalNotFound(goal=goal_id)
示例#4
0
文件: api.py 项目: crowdy/watcher
 def destroy_goal(self, goal_id):
     try:
         return self._destroy(models.Goal, goal_id)
     except exception.ResourceNotFound:
         raise exception.GoalNotFound(goal=goal_id)