Make populate_db set the is_bot flag on bot accounts.

(imported from commit 93a507faa2b19fde05376fd73ed3a65149cfce68)
This commit is contained in:
Kevin Mehall
2013-09-17 17:59:08 -04:00
parent e73e3d1bac
commit 63cff6eb71
2 changed files with 6 additions and 6 deletions

View File

@@ -15,7 +15,7 @@ def bulk_create_realms(realm_list):
existing_realms.add(domain)
Realm.objects.bulk_create(realms_to_create)
def bulk_create_users(realms, users_raw):
def bulk_create_users(realms, users_raw, bot=False):
"""
Creates and saves a UserProfile with the given email.
Has some code based off of UserManage.create_user, but doesn't .save()
@@ -33,7 +33,7 @@ def bulk_create_users(realms, users_raw):
for (email, full_name, short_name, active) in users:
domain = email_to_domain(email)
profile = create_user_profile(realms[domain], email,
initial_password(email), active, False,
initial_password(email), active, bot,
full_name, short_name, None)
profiles_to_create.append(profile)
UserProfile.objects.bulk_create(profiles_to_create)

View File

@@ -30,12 +30,12 @@ from optparse import make_option
settings.TORNADO_SERVER = None
def create_users(realms, name_list):
def create_users(realms, name_list, bot=False):
user_set = set()
for full_name, email in name_list:
short_name = email_to_username(email)
user_set.add((email, full_name, short_name, True))
bulk_create_users(realms, user_set)
bulk_create_users(realms, user_set, bot)
def create_streams(realms, realm, stream_list):
stream_set = set()
@@ -198,7 +198,7 @@ class Command(BaseCommand):
("Zulip Tutorial Bot", "tutorial-bot@zulip.com"),
("Zulip Email Gateway", "emailgateway@zulip.com"),
]
create_users(realms, hardcoded_zulip_users_nosubs)
create_users(realms, hardcoded_zulip_users_nosubs, bot=True)
if not options["test_suite"]:
# To keep the messages.json fixtures file for the test
@@ -236,7 +236,7 @@ class Command(BaseCommand):
("Zulip Nagios Bot", "nagios-bot@zulip.com"),
("Zulip Feedback Bot", "feedback@zulip.com"),
]
create_users(realms, internal_zulip_users_nosubs)
create_users(realms, internal_zulip_users_nosubs, bot=True)
# Mark all messages as read
with transaction.commit_on_success():