renewal-script: Make it not mail if there are no members needing renewal
This commit is contained in:
parent
2e9d68fdf8
commit
85ede4c945
1 changed files with 15 additions and 11 deletions
|
@ -60,18 +60,22 @@ def main(options=None):
|
||||||
|
|
||||||
|
|
||||||
members = get_members_which_need_renewal('month')
|
members = get_members_which_need_renewal('month')
|
||||||
emailtext = format_members_for_mail(members)
|
if not members:
|
||||||
|
log.warn('No one needs renewals! :-)')
|
||||||
|
|
||||||
today = datetime.date.today()
|
else: # We do have members
|
||||||
subject = "Memberships needing renewal (%s)" % today.strftime("%02Y-%02m")
|
emailtext = format_members_for_mail(members)
|
||||||
|
|
||||||
if sendmail:
|
today = datetime.date.today()
|
||||||
log.warn('Sending mail to %s: %s', to, subject)
|
subject = "Memberships needing renewal (%s)" % today.strftime("%02Y-%02m")
|
||||||
send_email(to, subject, emailtext)
|
|
||||||
else:
|
if sendmail:
|
||||||
log.info('Not sending mail to %s', to)
|
log.warn('Sending mail to %s: %s', to, subject)
|
||||||
log.info('%s', subject)
|
send_email(to, subject, emailtext)
|
||||||
log.info('%s', emailtext)
|
else:
|
||||||
|
log.info('Not sending mail to %s', to)
|
||||||
|
log.info('%s', subject)
|
||||||
|
log.info('%s', emailtext)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue