simplify list_from_comma_separated_tags
This commit is contained in:
parent
27ee2990e9
commit
83f3dfaff5
@ -362,21 +362,7 @@ def get_subscription_manager_page(env, start_response):
|
|||||||
).encode('utf-8')
|
).encode('utf-8')
|
||||||
|
|
||||||
def list_from_comma_separated_tags(string):
|
def list_from_comma_separated_tags(string):
|
||||||
tags = []
|
return [tag.strip() for tag in string.split(',') if tag.strip()]
|
||||||
prev_comma = -1
|
|
||||||
next_comma = string.find(',')
|
|
||||||
while next_comma != -1:
|
|
||||||
tag = string[prev_comma+1:next_comma].strip()
|
|
||||||
if tag:
|
|
||||||
tags.append(tag)
|
|
||||||
|
|
||||||
prev_comma = next_comma
|
|
||||||
next_comma = string.find(',', prev_comma+1)
|
|
||||||
|
|
||||||
last_tag = string[prev_comma+1:].strip()
|
|
||||||
if last_tag:
|
|
||||||
tags.append(last_tag)
|
|
||||||
return tags
|
|
||||||
|
|
||||||
|
|
||||||
unsubscribe_list_item_template = Template('''
|
unsubscribe_list_item_template = Template('''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user