summaryrefslogtreecommitdiff
path: root/keystone/resource
diff options
context:
space:
mode:
authorGage Hugo <gagehugo@gmail.com>2017-12-19 17:21:00 -0600
committerGage Hugo <gagehugo@gmail.com>2017-12-19 22:03:49 -0600
commitdb12357a6a16f9c6b322870a7f205e472b6be8c7 (patch)
tree35d8dd18bda8b9c51c8fcda370f98982daa2f12c /keystone/resource
parent07bba320ae3d0e7fb9d2fb2a1c5df51735761bac (diff)
downloadkeystone-db12357a6a16f9c6b322870a7f205e472b6be8c7.tar.gz
Refactor project tags encoding
This change moves the tags conversion to unicode into the Project class tags setter. Change-Id: Idc7b2de24252f3199fcdf19ca7bb822e7322d3f9
Diffstat (limited to 'keystone/resource')
-rw-r--r--keystone/resource/backends/sql.py9
1 files changed, 1 insertions, 8 deletions
diff --git a/keystone/resource/backends/sql.py b/keystone/resource/backends/sql.py
index 50de6651a..65d01ac23 100644
--- a/keystone/resource/backends/sql.py
+++ b/keystone/resource/backends/sql.py
@@ -38,11 +38,6 @@ class Resource(base.ResourceDriverBase):
else:
return ref
- def _encode_tags(self, ref):
- if ref.get('tags'):
- ref['tags'] = [text_type(t) for t in ref['tags']]
- return ref
-
def _is_hidden_ref(self, ref):
return ref.id == base.NULL_DOMAIN_ID
@@ -235,7 +230,6 @@ class Resource(base.ResourceDriverBase):
@sql.handle_conflicts(conflict_type='project')
def create_project(self, project_id, project):
new_project = self._encode_domain_id(project)
- new_project = self._encode_tags(new_project)
with sql.session_for_write() as session:
project_ref = Project.from_dict(new_project)
session.add(project_ref)
@@ -252,7 +246,6 @@ class Resource(base.ResourceDriverBase):
# When we read the old_project_dict, any "null" domain_id will have
# been decoded, so we need to re-encode it
old_project_dict = self._encode_domain_id(old_project_dict)
- old_project_dict = self._encode_tags(old_project_dict)
new_project = Project.from_dict(old_project_dict)
for attr in Project.attributes:
if attr != 'id':
@@ -335,7 +328,7 @@ class Project(sql.ModelBase, sql.ModelDictMixinWithExtras):
for tag in values:
tag_ref = ProjectTag()
tag_ref.project_id = self.id
- tag_ref.name = tag
+ tag_ref.name = text_type(tag)
new_tags.append(tag_ref)
self._tags = new_tags