Commit ed75bd2e authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch 'log-instead-of-print' into 'master'

Replace print statements by logging calls

See merge request !978
parents 5d028ecd c74c51cf
from django.conf import settings
from datetime import timedelta
import logging
from django.conf import settings
from django.core import mail
from django.template import loader
from django.template.defaultfilters import floatformat
......@@ -11,6 +13,9 @@ from django.utils.translation import ugettext as _
from members.models import Member, Membership
logger = logging.getLogger(__name__)
def send_membership_announcement(dry_run=False):
"""
Sends an email to all members with a never ending membership
......@@ -26,8 +31,9 @@ def send_membership_announcement(dry_run=False):
with mail.get_connection() as connection:
for member in members:
print("Send email to {} ({})".format(member.get_full_name(),
member.email))
logger.info("Sent email to %s (%s)",
member.get_full_name(),
member.email)
if not dry_run:
with translation.override(member.profile.language):
email_body = loader.render_to_string(
......@@ -63,8 +69,9 @@ def send_information_request(dry_run=False):
with mail.get_connection() as connection:
for member in members:
print("Send email to {} ({})".format(member.get_full_name(),
member.email))
logger.info("Sent email to %s (%s)",
member.get_full_name(),
member.email)
if not dry_run:
with translation.override(member.profile.language):
email_body = loader.render_to_string(
......@@ -107,8 +114,9 @@ def send_expiration_announcement(dry_run=False):
with mail.get_connection() as connection:
for member in members:
print("Send email to {} ({})".format(member.get_full_name(),
member.email))
logger.info("Sent email to %s (%s)",
member.get_full_name(),
member.email)
if not dry_run:
with translation.override(member.profile.language):
email_body = loader.render_to_string(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment