summaryrefslogtreecommitdiffstats
path: root/apps/patchwork/bin/patchwork-cron.py
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2011-03-29 22:18:54 +0800
committerJeremy Kerr <jk@ozlabs.org>2011-04-14 17:24:15 +0800
commitf94d40159168d0811de576328b77fd2a553039af (patch)
treef3e8b81347f832159462ef51437a49a192eea1e9 /apps/patchwork/bin/patchwork-cron.py
parent798a73b8bfb41f742e78e481ab9c961556e117b3 (diff)
downloadpatchwork-f94d40159168d0811de576328b77fd2a553039af.tar.bz2
patchwork-f94d40159168d0811de576328b77fd2a553039af.tar.xz
notifications: Add code to send notifications
Add a function (patchwork.utils.send_notifications) to process the PatchChangeNotification queue. We try to group mail to the same sender, by waiting settings.NOTIFICATION_DELAY_MINUTES to allow other notifications to arrive. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps/patchwork/bin/patchwork-cron.py')
-rwxr-xr-xapps/patchwork/bin/patchwork-cron.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/patchwork/bin/patchwork-cron.py b/apps/patchwork/bin/patchwork-cron.py
new file mode 100755
index 0000000..e9bd0c1
--- /dev/null
+++ b/apps/patchwork/bin/patchwork-cron.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+
+import sys
+from patchwork.utils import send_notifications
+
+def main(args):
+ errors = send_notifications()
+ for (recipient, error) in errors:
+ print "Failed sending to %s: %s" % (recipient.email, ex)
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
+