Rename comma_split to comma_space_split to better describe behavior.

master
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
def comma_split(s):
def comma_space_split(s):
'''
Split the string apart by commas, discarding all extra whitespace and
blank phrases.
Split the string apart by commas and spaces, discarding all extra
whitespace and blank phrases.
'a b, c,,d' -> ['a', 'b', 'c', 'd']
'''
if s is None:
return s

View File

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