From a8fa621f01ed2584b581cf6ccfedcadc03c3f083 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Fri, 4 Sep 2020 17:00:01 -0700 Subject: [PATCH] Rewrite helpers.comma_space_split with a simple regex. --- etiquette/helpers.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/etiquette/helpers.py b/etiquette/helpers.py index 8079586..818ea5a 100644 --- a/etiquette/helpers.py +++ b/etiquette/helpers.py @@ -113,10 +113,7 @@ def comma_space_split(s): ''' if s is None: return s - s = s.replace(' ', ',') - s = [x.strip() for x in s.split(',')] - s = [x for x in s if x] - return s + return re.split(r'[ ,]+', s.strip()) def generate_image_thumbnail(filepath, width, height): if not os.path.isfile(filepath):