Merge "Don't query stack tags twice"
This commit is contained in:
commit
fe2d05164c
@ -71,11 +71,8 @@ class Stack(
|
|||||||
raw_template.RawTemplate.get_by_id(
|
raw_template.RawTemplate.get_by_id(
|
||||||
context, db_stack['raw_template_id']))
|
context, db_stack['raw_template_id']))
|
||||||
elif field == 'tags':
|
elif field == 'tags':
|
||||||
if db_stack.get(field) is not None:
|
stack['tags'] = stack_tag.StackTagList.from_db_object(
|
||||||
stack['tags'] = stack_tag.StackTagList.get(
|
context, db_stack.get(field))
|
||||||
context, db_stack['id'])
|
|
||||||
else:
|
|
||||||
stack['tags'] = None
|
|
||||||
else:
|
else:
|
||||||
stack[field] = db_stack.__dict__.get(field)
|
stack[field] = db_stack.__dict__.get(field)
|
||||||
stack._context = context
|
stack._context = context
|
||||||
|
@ -80,3 +80,8 @@ class StackTagList(
|
|||||||
@classmethod
|
@classmethod
|
||||||
def delete(cls, context, stack_id):
|
def delete(cls, context, stack_id):
|
||||||
db_api.stack_tags_delete(context, stack_id)
|
db_api.stack_tags_delete(context, stack_id)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_db_object(cls, context, db_tags):
|
||||||
|
if db_tags is not None:
|
||||||
|
return base.obj_make_list(context, cls(), StackTag, db_tags)
|
||||||
|
Loading…
Reference in New Issue
Block a user