Beispiel #1
0
from wsme import types as wtypes
import wsmeext.pecan as wsme_pecan

from storyboard.api.auth import authorization_checks as checks
from storyboard.api.v1.search import search_engine
from storyboard.api.v1 import wmodels
from storyboard.common import decorators
from storyboard.common import event_types
from storyboard.common import exception as exc
from storyboard.db.api import comments as comments_api
from storyboard.db.api import timeline_events as events_api
from storyboard.openstack.common.gettextutils import _  # noqa

CONF = cfg.CONF

SEARCH_ENGINE = search_engine.get_engine()


class TimeLineEventsController(rest.RestController):
    """Manages comments."""

    @decorators.db_exceptions
    @secure(checks.guest)
    @wsme_pecan.wsexpose(wmodels.TimeLineEvent, int, int)
    def get_one(self, story_id, event_id):
        """Retrieve details about one event.

        :param story_id: An ID of the story. It stays in params as a
                         placeholder so that pecan knows where to match an
                         incoming value. It will stay unused, as far as events
                         have their own unique ids.
Beispiel #2
0
from storyboard.api.v1.search import search_engine
from storyboard.api.v1 import validations
from storyboard.api.v1 import wmodels
from storyboard.common import decorators
from storyboard.common import exception as exc
from storyboard.db.api import branches as branches_api
from storyboard.db.api import milestones as milestones_api
from storyboard.db.api import stories as stories_api
from storyboard.db.api import story_types as story_types_api
from storyboard.db.api import tasks as tasks_api
from storyboard.db.api import timeline_events as events_api
from storyboard.openstack.common.gettextutils import _  # noqa

CONF = cfg.CONF

SEARCH_ENGINE = search_engine.get_engine()


def milestone_is_valid(task):
    """Check that milestone exists, milestone and task associated with the
    same branch and milestone is not expired.
    """

    milestone_id = task.milestone_id
    milestone = milestones_api.milestone_get(milestone_id)

    if not milestone:
        raise exc.NotFound(_("Milestone %s not found.") %
                           milestone_id)

    if milestone['expired']: