User.get_or_create: cut down extra puts

pull/1238/head
Ryan Barrett 2024-08-05 13:48:44 -07:00
rodzic 29482d1c66
commit c47f3640e6
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -268,13 +268,13 @@ class User(StringIdModel, metaclass=ProtocolUserMeta):
if ((old_val is None and new_val is not None)
or (field == 'direct' and not old_val and new_val)):
setattr(user, field, new_val)
user.put()
if enabled_protocols := kwargs.get('enabled_protocols'):
user.enabled_protocols = (set(user.enabled_protocols)
| set(enabled_protocols))
if not propagate:
user.put()
return user
else:
if orig := get_original(id):