Kill script early if show is not in lists
The script will stop if the show is not found in lists. Before, non listed shows were trying to be sent without emails addresses, causing errors.
This commit is contained in:
parent
24225db205
commit
3c6ee9966d
@ -42,6 +42,12 @@ users = [{'email': 'user1@gmail.com',
|
||||
'shows': ('show1', 'show2', 'show3', 'show4')
|
||||
}]
|
||||
|
||||
# Kill script now if show_name is not in lists
|
||||
to = list('Match' for u in users if p.show_name in u['shows'])
|
||||
if not to:
|
||||
exit
|
||||
|
||||
# Join email addresses
|
||||
to = ','.join([u['email'] for u in users if p.show_name in u['shows']])
|
||||
|
||||
# Email settings
|
||||
|
Loading…
Reference in New Issue
Block a user