]> git.ozlabs.org Git - patchwork/blob - patchwork/management/commands/cron.py
management: Resolve bugs with 'cron' command
[patchwork] / patchwork / management / commands / cron.py
1 from django.core.management.base import BaseCommand, CommandError
2 from patchwork.utils import send_notifications, do_expiry
3
4 class Command(BaseCommand):
5     help = ('Run periodic patchwork functions: send notifications and ' 
6             'expire unused users')
7
8     def handle(self, *args, **kwargs):
9         errors = send_notifications()
10         for (recipient, error) in errors:
11             self.stderr.write("Failed sending to %s: %s" %
12                                 (recipient.email, error))
13
14         do_expiry()