From: Seth Woodworth Date: Mon, 8 Jul 2013 19:20:48 +0000 (-0400) Subject: cleanup and comment sanitize script X-Git-Tag: release-20150131~399 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d89cf8bb22828658bc39b400942aed6a7686f16b;p=oweals%2Fkarmaworld.git cleanup and comment sanitize script --- diff --git a/karmaworld/apps/courses/management/commands/sanitize_usde_schools.py b/karmaworld/apps/courses/management/commands/sanitize_usde_schools.py index aee5e49..d915b89 100644 --- a/karmaworld/apps/courses/management/commands/sanitize_usde_schools.py +++ b/karmaworld/apps/courses/management/commands/sanitize_usde_schools.py @@ -29,7 +29,6 @@ class Command(BaseCommand): args = 'none' help = """ Delete Schools that contain RESTRICTED WORDS in their names """ - def get_input(self, input_prompt): """ Get user input with repeated requests on incorrect input """ @@ -46,9 +45,9 @@ class Command(BaseCommand): return self.get_input(error_prompt + input_prompt) - - def handle(self, *args, **kwargs): + """ The function that gets called to run this command """ + # generate an |(or)'d list of queries searching inexact for each of RESTRICTED_WORDS queries_list = map(lambda word: Q(name__icontains=word), RESTRICTED_WORDS) queries_or = reduce(lambda a, b: a | b, queries_list) schools = School.objects.filter(queries_or)