Skip to content

Add support for multiple audiences#36

Open
jstevensfit wants to merge 2 commits intowichert:masterfrom
jstevensfit:master
Open

Add support for multiple audiences#36
jstevensfit wants to merge 2 commits intowichert:masterfrom
jstevensfit:master

Conversation

@jstevensfit
Copy link
Copy Markdown
Contributor

  • Add support for a comma separated list of audiences
  • Existing functionality for a single audience is supported
  • Provided tests for new functionality

Copy link
Copy Markdown
Owner

@wichert wichert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change changes the API by turning audience into a list. Can you add a clear note to the changelog and readme to warn about that?

Comment on lines +97 to +107
def _aud_string_to_list(self, audience):
"""
Splits the audience variable into a
list to handle multiple audiences.
:param audience: Comma separated list of audiences
:return: List of one or more audiences
"""
if audience is None:
return None
else:
return audience.split(',')
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move that method out of the class into a separate function? Since it doesn't need to use anything from self there is no need for it to be a method.

I would also suggest splitting on something like re.split(r'\s*,\s*, audience)` to make this a bit friendlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants