Ejemplo n.º 1
0
    def handle(self, *args, **options):

        if not args:
            print >> sys.stderr, "Usage: ./manage.py delete-sanitizing-rules <slug> [<slug2> ...]"
            return


        for n, slug in enumerate(args):
            rule = SanitizingRule.for_slug(slug)

            if rule:
                self.delete_rule(rule=rule)

            progress(n+1, len(args))
Ejemplo n.º 2
0
    def handle(self, *args, **options):

        if not args:
            print >> sys.stderr, "Usage: ./manage.py sync-sanitizing-rules <filename> [<filename2> ...]"
            return


        for filename in args:
            config = ConfigParser.ConfigParser()
            config.read(filename)
            sections = config.sections()

            for n, slug in enumerate(sections):
                rule = SanitizingRule.for_slug(slug) or SanitizingRule()

                self.update_rule(rule=rule, config=config, slug=slug)

                progress(n+1, len(sections), filename)