mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-23 18:15:53 +03:00
Extract group_id from the dict for multiple use
This commit is contained in:
parent
e836bdf734
commit
7fb0e98b03
1 changed files with 5 additions and 4 deletions
|
@ -127,19 +127,20 @@ class ApplicationService(object):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Expected bool for 'exclusive' in ns '%s'" % ns
|
"Expected bool for 'exclusive' in ns '%s'" % ns
|
||||||
)
|
)
|
||||||
if regex_obj.get("group_id"):
|
group_id = regex_obj.get("group_id")
|
||||||
if not isinstance(regex_obj.get("group_id"), str):
|
if group_id:
|
||||||
|
if not isinstance(group_id, str):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Expected string for 'group_id' in ns '%s'" % ns
|
"Expected string for 'group_id' in ns '%s'" % ns
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
GroupID.from_string(regex_obj.get("group_id"))
|
GroupID.from_string(group_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Expected valid group ID for 'group_id' in ns '%s'" % ns
|
"Expected valid group ID for 'group_id' in ns '%s'" % ns
|
||||||
)
|
)
|
||||||
|
|
||||||
if get_domain_from_id(regex_obj.get("group_id")) != self.server_name:
|
if get_domain_from_id(group_id) != self.server_name:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Expected 'group_id' to be this host in ns '%s'" % ns
|
"Expected 'group_id' to be this host in ns '%s'" % ns
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue