From 712d9313501ac5ec8571b3db470b7e5dccba9f79 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 28 Mar 2013 15:48:12 -0400 Subject: [PATCH] Remove banish_broken management command. The bug it addresses is long fixed, and it's buggy. (imported from commit b198a30f56f950168e3662dcea2bab7d908631f9) --- zephyr/management/commands/banish_broken.py | 25 --------------------- 1 file changed, 25 deletions(-) delete mode 100644 zephyr/management/commands/banish_broken.py diff --git a/zephyr/management/commands/banish_broken.py b/zephyr/management/commands/banish_broken.py deleted file mode 100644 index a7539a4b16..0000000000 --- a/zephyr/management/commands/banish_broken.py +++ /dev/null @@ -1,25 +0,0 @@ -from optparse import make_option -from django.core.management.base import BaseCommand - -from zephyr.models import Realm, UserProfile - -# Helper to be used with manage.py shell to get rid of bad users on prod. -def banish_busted_users(change=False): - for u in UserProfile.objects.select_related().all(): - if (u.is_active or u.realm.domain != "mit.edu"): - continue - (banished_realm, _) = Realm.objects.get_or_create(domain="mit.deleted") - if "|mit.edu@mit.edu" in u.email.lower(): - print u.email - if change: - u.realm = banished_realm - u.email = u.email.split("@")[0] + "@" + banished_realm.domain - u.user.save() - u.save() - -class Command(BaseCommand): - option_list = BaseCommand.option_list + ( - make_option('--dry-run', '-n', dest='dry_run', default=False, action='store_true'),) - - def handle(self, *args, **options): - banish_busted_users(change=not options['dry_run'])