def handle(self, *args, **options):
        # Autodiscover all reports by scanning INSTALLED_APPS for reports.py
        # files.
        reporter.autodiscover()
        
        if options.get('list_all', False):
            # List all reports, printing their docstrings
            print "Listing all available reports:"
            available_reports = reporter.get_all()
            frequencies = ['daily', 'weekly', 'monthly']
            for frq in frequencies:
                reports_found = []
                for report_name, report in available_reports.items():
                    if frq in report.frequencies:
                        reports_found.append('    %s - %s' %
                                             (report_name,
                                              report.__doc__.strip()))
                if reports_found:
                    print frq.capitalize() % '\n%s:'
                    for report in reports_found:
                        print report
            print ('\nFor more information on how to run reports, use this '
                   'command with the -h option.')
            exit(0)
        
        # Make sure the right number of arguments was provided
        if len(args) < 2:
            raise CommandError('Please provide both a frequency and a '
                               'report name.')
        if not args[0] in ('daily', 'weekly', 'monthly'):
            raise CommandError('Please provide a valid frequency.')
        
        frequency = args[0]
        name = args[1]
        report_args = None
        if len(args) > 2:
            report_args = args[2:]
        date = options.get('date', None)
        if date:
            date = datetime.datetime.strptime(date, '%Y-%m-%d')
            date = datetime.date(date.year, date.month, date.day)
        filename = options.get('filename', None)
        view = options.get('view', False)
        recipients = options.get('recipients', None)
        if recipients:
            recipients = recipients.split(',')
        
        try:
            report_class = reporter.get_report(name)
            report = report_class(frequency, date, view, filename, recipients,
                                  report_args)
        except (reporter.NotRegistered, reporter.NotAvailable), e:
            raise CommandError(e)
        report.run_report()
dataset/ETHPy150Open bkonkle/django-reporter/reporter/management/commands/report.py/Command.handle/swapped operands of `%`