def handle(self, **options): class optz(object): def __init__(self, options): self.feed = options['feed'] self.site = options['site'] self.timeout = options['timeout'] self.delay = options['delay'] self.max_diff = options['max_diff'] self.force = options['force'] self.hidden = options['hidden'] if options.get('debug'): logging.basicConfig(level=logging.DEBUG) #elif options.get('verbose'): logging.basicConfig(level=logging.EXTRA) elif options.get('quiet'): logging.basicConfig(level=logging.WARNING) else: logging.basicConfig(level=logging.INFO) bulk_update(optz(options))
) parser.add_option("-s", "--site", action="append", type="int", help="A site id (or several of them) to update.") parser.add_option( "-t", "--timeout", type="int", default=20, help="Socket timeout (in seconds) for connections (default: %(default)s).", ) parser.add_option("-d", "--delay", type="int", default=0, help="Delay between fetching the feeds (default: none).") parser.add_option("-q", "--quiet", action="store_true", help="Report only severe errors, no info or warnings.") parser.add_option("-v", "--verbose", action="store_true", help="Verbose output.") parser.add_option("--debug", action="store_true", help="Even more verbose output.") optz, argz = parser.parse_args() if argz: parser.error("This command takes no arguments") if optz.debug: logging.basicConfig(level=logging.DEBUG) elif optz.verbose: logging.basicConfig(level=logging.EXTRA) elif optz.quiet: logging.basicConfig(level=logging.WARNING) else: logging.basicConfig(level=logging.INFO) bulk_update(optz)