summaryrefslogtreecommitdiffstats
path: root/keystone/common/controller.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-01-13 22:53:04 +0000
committerGerrit Code Review <review@openstack.org>2013-01-13 22:53:04 +0000
commitceec5c0bd06f2960cc637882b315f102433d8cc0 (patch)
treeb68db014d980abc8b393bc32596693dceb958f0b /keystone/common/controller.py
parent26c807bf93d18704f0b3180dccd693a85c327789 (diff)
parent3a38ecfc8868c95ad3df43de22b29f08f2c9d4cf (diff)
downloadkeystone-ceec5c0bd06f2960cc637882b315f102433d8cc0.tar.gz
keystone-ceec5c0bd06f2960cc637882b315f102433d8cc0.tar.xz
keystone-ceec5c0bd06f2960cc637882b315f102433d8cc0.zip
Merge "Validated URLs in v2 endpoint creation API"
Diffstat (limited to 'keystone/common/controller.py')
-rw-r--r--keystone/common/controller.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/keystone/common/controller.py b/keystone/common/controller.py
index f9ce0b46..5af85c6e 100644
--- a/keystone/common/controller.py
+++ b/keystone/common/controller.py
@@ -59,7 +59,12 @@ def protected(f):
@dependency.requires('identity_api', 'policy_api', 'token_api')
class V2Controller(wsgi.Application):
"""Base controller class for Identity API v2."""
- pass
+
+ def _require_attribute(self, ref, attr):
+ """Ensures the reference contains the specified attribute."""
+ if ref.get(attr) is None or ref.get(attr) == '':
+ msg = '%s field is required and cannot be empty' % attr
+ raise exception.ValidationError(message=msg)
class V3Controller(V2Controller):
@@ -71,12 +76,6 @@ class V3Controller(V2Controller):
per_page = context['query_string'].get('per_page', 30)
return refs[per_page * (page - 1):per_page * page]
- def _require_attribute(self, ref, attr):
- """Ensures the reference contains the specified attribute."""
- if ref.get(attr) is None or ref.get(attr) == '':
- msg = '%s field is required and cannot be empty' % attr
- raise exception.ValidationError(message=msg)
-
def _require_matching_id(self, value, ref):
"""Ensures the value matches the reference's ID, if any."""
if 'id' in ref and ref['id'] != value: