Merge "Revert "Name fields checked with regex""

This commit is contained in:
Jenkins 2014-06-09 07:15:10 +00:00 committed by Gerrit Code Review
commit e30e1cb406
4 changed files with 6 additions and 37 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)