aboutsummaryrefslogtreecommitdiff
path: root/patchwork/management/commands/cron.py
blob: 7c00ea36d72018e2e1dae69f918e83adf03c26d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from django.core.management.base import BaseCommand
from patchwork.utils import send_notifications, do_expiry


class Command(BaseCommand):
    help = ('Run periodic patchwork functions: send notifications and '
            'expire unused users')

    def handle(self, *args, **kwargs):
        errors = send_notifications()
        for (recipient, error) in errors:
            self.stderr.write("Failed sending to %s: %s" %
                              (recipient.email, error))

        do_expiry()