aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-11-18 23:14:42 +0200
committerFilipp Lepalaan <filipp@mac.com>2015-11-18 23:14:42 +0200
commitdd9b4920713145e51eeef74063c15d715a746d37 (patch)
treeda6104f47d60c6b381d65cc0a68f2f84494730c4
parentede335fca47f15f05b5134680dd2f254d91a3718 (diff)
downloadServo-dd9b4920713145e51eeef74063c15d715a746d37.tar.gz
Servo-dd9b4920713145e51eeef74063c15d715a746d37.tar.bz2
Servo-dd9b4920713145e51eeef74063c15d715a746d37.zip
Fail silently with invalid emails in cron jobs
-rwxr-xr-xservo/management/commands/cron.py7
-rw-r--r--servo/migrations/0044_auto_20151118_2310.py19
2 files changed, 26 insertions, 0 deletions
diff --git a/servo/management/commands/cron.py b/servo/management/commands/cron.py
index adc6d34..eaed8bd 100755
--- a/servo/management/commands/cron.py
+++ b/servo/management/commands/cron.py
@@ -6,6 +6,7 @@ from datetime import date, timedelta
from django.conf import settings
from django.core.files import File
from django.core.mail import send_mail
+from django.core.validators import validate_email
from django.utils.translation import ugettext as _
from django.core.management.base import BaseCommand
@@ -22,6 +23,12 @@ def send_table(sender, recipient, subject, table, send_empty=False):
if send_empty is False and table.has_body() is False:
return
+ try:
+ validate_email(sender)
+ validate_email(recipient)
+ except Exception:
+ return
+
config = Configuration.conf()
host, port = Configuration.get_smtp_server()
diff --git a/servo/migrations/0044_auto_20151118_2310.py b/servo/migrations/0044_auto_20151118_2310.py
new file mode 100644
index 0000000..dddef82
--- /dev/null
+++ b/servo/migrations/0044_auto_20151118_2310.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('servo', '0043_auto_20151109_1354'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='calendar',
+ name='hours_per_day',
+ field=models.FloatField(help_text='How many hours per day should be in this calendar', null=True, verbose_name='Hours per day', blank=True),
+ ),
+ ]