Skip to content

Commit

Permalink
correct and simplify topic listification
Browse files Browse the repository at this point in the history
  • Loading branch information
petersilva committed Aug 27, 2024
1 parent d72b920 commit 7367b52
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions sarracenia/postformat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,19 @@ def topicDerive(msg, options, topicOverride=None ) -> list:
topic_separator='.'

if topicOverride:
if topicOverride is list:
topic = topicOverride
else:
topic = topicOverride.split(topic_separator)
elif 'topic' in options and options['topic'] and (type(options['topic']) is not list):
topic = options['topic'].split(topic_separator)
topic = topicOverride
elif 'topic' in options and options['topic']:
topic = options['topic']
elif 'relPath' in msg:
topic = topic_prefix + msg['relPath'].split('/')[0:-1]
elif 'subtopic' in msg:
topic = topic_prefix + msg['subtopic']
else:
if 'relPath' in msg:
topic = topic_prefix + msg['relPath'].split('/')[0:-1]
elif 'subtopic' in msg:
topic = topic_prefix + msg['subtopic']
else:
topic = topic_prefix
topic = topic_prefix

if type(topic) is not list:
topic = topic.split(topic_separator)

return topic


Expand Down

0 comments on commit 7367b52

Please sign in to comment.