mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 10:57:58 +00:00
realm: Add registry of realm property types.
This makes it possible for us to do some convenient validation for developers, checking whether the correct types are passed for each each realm property.
This commit is contained in:
@@ -422,9 +422,11 @@ def active_humans_in_realm(realm):
|
||||
|
||||
|
||||
def do_set_realm_property(realm, name, value):
|
||||
# type: (Realm, Text, Union[Text, bool, int]) -> None
|
||||
# type: (Realm, str, Union[Text, bool, int]) -> None
|
||||
"""Takes in a realm object, the name of an attribute to update, and the value to update.
|
||||
"""
|
||||
property_type = Realm.property_types[name]
|
||||
assert isinstance(value, property_type)
|
||||
setattr(realm, name, value)
|
||||
realm.save(update_fields=[name])
|
||||
event = dict(
|
||||
|
||||
Reference in New Issue
Block a user