summaryrefslogtreecommitdiffstats
path: root/keystone/clean.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-11-20 20:01:58 +0000
committerGerrit Code Review <review@openstack.org>2012-11-20 20:01:58 +0000
commit715a17b71d065efe93a39721a40a4d58508d0cb6 (patch)
tree5823ea8266b57c3eb8d653c23370a17691330ad8 /keystone/clean.py
parent438ace0754b9a4e3bc2d939ba47479ec0df34375 (diff)
parentddc8c833684ff0db65553b09b87eed7b80c7075d (diff)
downloadkeystone-715a17b71d065efe93a39721a40a4d58508d0cb6.tar.gz
keystone-715a17b71d065efe93a39721a40a4d58508d0cb6.tar.xz
keystone-715a17b71d065efe93a39721a40a4d58508d0cb6.zip
Merge "v3 Identity"
Diffstat (limited to 'keystone/clean.py')
-rw-r--r--keystone/clean.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/keystone/clean.py b/keystone/clean.py
index 8eb63b0d..89d56762 100644
--- a/keystone/clean.py
+++ b/keystone/clean.py
@@ -37,15 +37,20 @@ def check_type(property_name, value, expected_type, display_expected_type):
raise exception.ValidationError(msg)
-def tenant_name(name):
- check_type("Tenant name", name, basestring, "string or unicode")
+def check_name(property_name, name):
+ check_type('%s name' % property_name, name, basestring, 'str or unicode')
name = name.strip()
- check_length("Tenant name", name)
+ check_length('%s name' % property_name, name)
return name
+def domain_name(name):
+ return check_name('Domain', name)
+
+
+def tenant_name(name):
+ return check_name('Tenant', name)
+
+
def user_name(name):
- check_type("User name", name, basestring, "string or unicode")
- name = name.strip()
- check_length("User name", name)
- return name
+ return check_name('User', name)