from traceback import format_exc from django.core.management.base import BaseCommand from sitemessage.compat import CommandOption, options_getter from sitemessage.toolbox import check_undelivered get_options = options_getter((CommandOption( '--to', action='store', dest='to', default=None, help='Recipient e-mail. If not set Django ADMINS setting is used.'), )) class Command(BaseCommand): help = 'Sends a notification email if any undelivered dispatches.' option_list = get_options() def add_arguments(self, parser): get_options(parser.add_argument) def handle(self, *args, **options): to = options.get('to', None) self.stdout.write('Checking for undelivered dispatches ...\n') try:
from traceback import format_exc from django.core.management.base import BaseCommand from sitemessage.compat import CommandOption, options_getter from sitemessage.toolbox import send_test_message get_options = options_getter(( CommandOption( '--to', action='store', dest='to', default=None, help='Recipient address (if supported by messenger).' ), )) class Command(BaseCommand): help = 'Removes sent dispatches from DB.' option_list = get_options() args = '[messenger]' def add_arguments(self, parser): parser.add_argument('messenger', metavar='messenger', help='Messenger to test.') get_options(parser.add_argument) def handle(self, messenger, *args, **options): to = options.get('to', None)
from traceback import format_exc from django.core.management.base import BaseCommand from sitemessage.compat import CommandOption, options_getter from sitemessage.toolbox import cleanup_sent_messages get_options = options_getter(( CommandOption( '--ago', action='store', dest='ago', default=None, type=int, help='Allows cleanup messages sent X days ago. Defaults to None (cleanup all sent).' ), CommandOption('--dispatches_only', action='store_false', dest='dispatches_only', default=False, help='Remove dispatches only (messages objects will stay intact).'), )) class Command(BaseCommand): help = 'Removes sent dispatches from DB.' option_list = get_options() def add_arguments(self, parser): get_options(parser.add_argument) def handle(self, *args, **options): ago = options.get('ago', None) dispatches_only = options.get('dispatches_only', False)
from traceback import format_exc from django.core.management.base import BaseCommand from sitemessage.compat import CommandOption, options_getter from sitemessage.toolbox import cleanup_sent_messages get_options = options_getter(( CommandOption( '--ago', action='store', dest='ago', default=None, type=int, help= 'Allows cleanup messages sent X days ago. Defaults to None (cleanup all sent).' ), CommandOption( '--dispatches_only', action='store_false', dest='dispatches_only', default=False, help='Remove dispatches only (messages objects will stay intact).'), )) class Command(BaseCommand): help = 'Removes sent dispatches from DB.' option_list = get_options()
from traceback import format_exc from django.core.management.base import BaseCommand from sitemessage.compat import CommandOption, options_getter from sitemessage.toolbox import send_scheduled_messages get_options = options_getter((CommandOption( '--priority', action='store', dest='priority', default=None, help= 'Allows to filter scheduled messages by a priority number. Defaults to None.' ), )) class Command(BaseCommand): help = 'Sends scheduled messages (both in pending and error statuses).' option_list = get_options() def add_arguments(self, parser): get_options(parser.add_argument) def handle(self, *args, **options): priority = options.get('priority', None) priority_str = '' if priority is not None: