make tag handling more robust

If no tag is set, do not add anything. If None was accidentally
included in the set of tags before, remove it now. If proposing the
tags results in an error, log it and keep moving.

Change-Id: Ic69f7b39f096d9c0a9cc5a2eb434a00048b88adc
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-08-01 09:52:57 -04:00
parent 78ce365758
commit 4fbf1078eb

View File

@ -91,9 +91,16 @@ def _update_tags(sbc, story, tag):
tags = set(story.tags or [])
if tag in tags:
return
if not tag:
return
LOG.info('adding tag %s', tag)
tags.add(tag)
story.tags_manager.update(list(tags))
if None in tags:
tags.remove(None)
try:
story.tags_manager.update(list(tags))
except Exception as err:
LOG.info(err)
def main():