Rename comma_split to comma_space_split to better describe behavior.

This commit is contained in:
voussoir 2017-12-07 20:58:06 -08:00
parent 156e467814
commit 6cf355d7ce
2 changed files with 8 additions and 6 deletions

View file

@ -127,10 +127,12 @@ def chunk_sequence(sequence, chunk_length, allow_incomplete=True):
return chunks return chunks
def comma_split(s): def comma_space_split(s):
''' '''
Split the string apart by commas, discarding all extra whitespace and Split the string apart by commas and spaces, discarding all extra
blank phrases. whitespace and blank phrases.
'a b, c,,d' -> ['a', 'b', 'c', 'd']
''' '''
if s is None: if s is None:
return s return s

View file

@ -189,7 +189,7 @@ def normalize_authors(authors, photodb, warning_bag=None):
return None return None
if isinstance(authors, str): if isinstance(authors, str):
authors = helpers.comma_split(authors) authors = helpers.comma_space_split(authors)
user_ids = set() user_ids = set()
for requested_author in authors: for requested_author in authors:
@ -219,7 +219,7 @@ def normalize_extensions(extensions):
return None return None
if isinstance(extensions, str): if isinstance(extensions, str):
extensions = helpers.comma_split(extensions) extensions = helpers.comma_space_split(extensions)
if len(extensions) == 0: if len(extensions) == 0:
return None return None
@ -382,7 +382,7 @@ def normalize_tag_mmf(tags, photodb, warning_bag=None):
return None return None
if isinstance(tags, str): if isinstance(tags, str):
tags = helpers.comma_split(tags) tags = helpers.comma_space_split(tags)
tagset = set() tagset = set()
for tag in tags: for tag in tags: