diff options
author | Luke Barnard <luke@matrix.org> | 2017-11-16 18:18:30 +0000 |
---|---|---|
committer | Luke Barnard <luke@matrix.org> | 2017-11-16 18:18:30 +0000 |
commit | 7fb0e98b0327f56f13bad7c21e897911e1e2a355 (patch) | |
tree | 6744a55a2e25b8d9d43417b9e4d1600ba036f212 | |
parent | Fix tests (diff) | |
download | synapse-7fb0e98b0327f56f13bad7c21e897911e1e2a355.tar.xz |
Extract group_id from the dict for multiple use
-rw-r--r-- | synapse/appservice/__init__.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/synapse/appservice/__init__.py b/synapse/appservice/__init__.py index f330d77b69..d5a7a5ce2f 100644 --- a/synapse/appservice/__init__.py +++ b/synapse/appservice/__init__.py @@ -127,19 +127,20 @@ class ApplicationService(object): raise ValueError( "Expected bool for 'exclusive' in ns '%s'" % ns ) - if regex_obj.get("group_id"): - if not isinstance(regex_obj.get("group_id"), str): + group_id = regex_obj.get("group_id") + if group_id: + if not isinstance(group_id, str): raise ValueError( "Expected string for 'group_id' in ns '%s'" % ns ) try: - GroupID.from_string(regex_obj.get("group_id")) + GroupID.from_string(group_id) except Exception: raise ValueError( "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( "Expected 'group_id' to be this host in ns '%s'" % ns ) |