Supply a name when creating realms.

For our populate_db bulk creation, just use the domain.

(imported from commit 4fb756f6dfa2d8f90e55822e27891e84168d5d1c)
This commit is contained in:
Jessica McKellar
2013-10-17 11:47:30 -04:00
parent 5c5ffd6ea3
commit 6dbf7613a1
3 changed files with 20 additions and 7 deletions

View File

@@ -1108,11 +1108,12 @@ def do_rename_stream(realm, old_name, new_name, log=True):
# email forwarding address to display the correctly-escaped new name.
return {"email_address": encode_email_address(stream)}
def do_create_realm(domain, restricted_to_domain=True):
def do_create_realm(domain, name, restricted_to_domain=True):
realm = get_realm(domain)
created = not realm
if created:
realm = Realm(domain=domain, restricted_to_domain=restricted_to_domain)
realm = Realm(domain=domain, name=name,
restricted_to_domain=restricted_to_domain)
realm.save()
# Create stream once Realm object has been saved