diff --git a/storyboard/api/v1/projects.py b/storyboard/api/v1/projects.py index f267c800..e608f828 100644 --- a/storyboard/api/v1/projects.py +++ b/storyboard/api/v1/projects.py @@ -23,7 +23,6 @@ import wsmeext.pecan as wsme_pecan from storyboard.api.auth import authorization_checks as checks from storyboard.api.v1 import base -from storyboard.common import custom_types from storyboard.db.api import projects as projects_api CONF = cfg.CONF @@ -36,9 +35,9 @@ class Project(base.APIBase): Storyboard as Projects, among others. """ - name = custom_types.Name() - """At least three letters or digits. Also brackets, underscore, and - whitespaces are allowed. + name = wtypes.text + """At least one lowercase letter or number, followed by letters, numbers, + dots, hyphens or pluses. Keep this name short; it is used in URLs. """ description = wtypes.text diff --git a/storyboard/api/v1/stories.py b/storyboard/api/v1/stories.py index b193ee73..9476d7b3 100644 --- a/storyboard/api/v1/stories.py +++ b/storyboard/api/v1/stories.py @@ -26,7 +26,6 @@ from storyboard.api.auth import authorization_checks as checks from storyboard.api.v1 import base from storyboard.api.v1.timeline import CommentsController from storyboard.api.v1.timeline import TimeLineEventsController -from storyboard.common import custom_types from storyboard.db.api import stories as stories_api from storyboard.db.api import timeline_events as events_api @@ -40,7 +39,7 @@ class Story(base.APIBase): Project and branch. """ - title = custom_types.Name() + title = wtypes.text """A descriptive label for the story, to show in listings.""" description = wtypes.text diff --git a/storyboard/api/v1/tasks.py b/storyboard/api/v1/tasks.py index a6adf889..afb1cfd0 100644 --- a/storyboard/api/v1/tasks.py +++ b/storyboard/api/v1/tasks.py @@ -24,7 +24,6 @@ import wsmeext.pecan as wsme_pecan from storyboard.api.auth import authorization_checks as checks from storyboard.api.v1 import base -from storyboard.common import custom_types from storyboard.db.api import tasks as tasks_api from storyboard.db.api import timeline_events as events_api @@ -38,8 +37,8 @@ class Task(base.APIBase): is generally linked to a code change proposed in Gerrit. """ - title = custom_types.Name() - """A descriptive title. Will be displayed in lists.""" + title = wtypes.text + """An optional short label for the task, to show in listings.""" # TODO(ruhe): replace with enum status = wtypes.text diff --git a/storyboard/common/custom_types.py b/storyboard/common/custom_types.py deleted file mode 100644 index f1ca2558..00000000 --- a/storyboard/common/custom_types.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2014 Mirantis Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from wsme import types - - -class Name(types.StringType): - - # alpha-numeric, all kind of brackets, minus, slash, underscore and space - # at least 3 alpha-numeric symbols - _name_regex = r'^[a-zA-Z0-9\-_\[\]\(\)\{\}/\s]*' \ - r'[a-zA-Z0-9]{3,}' \ - r'[a-zA-Z0-9\-_\[\]\(\)\{\}/\s]*$' - - def __init__(self): - super(Name, self).__init__(pattern=self._name_regex)