do_create_user: Use transaction.atomic.

Have kept process_new_human_user out of
the atomic block because it involves many
different operations and also sends events.
Tried enclosing event in on_commit but that
would need many changes in the tests, so have
skipped it for now.
This commit is contained in:
Sahil Batra 2021-12-08 17:32:09 +05:30 committed by Tim Abbott
parent 9321095406
commit 168f241ff0
1 changed files with 53 additions and 53 deletions

View File

@ -655,7 +655,7 @@ def do_create_user(
acting_user: Optional[UserProfile], acting_user: Optional[UserProfile],
enable_marketing_emails: bool = True, enable_marketing_emails: bool = True,
) -> UserProfile: ) -> UserProfile:
with transaction.atomic():
user_profile = create_user( user_profile = create_user(
email=email, email=email,
password=password, password=password,