diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-07-21 14:12:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-21 18:12:22 +0000 |
commit | 590cc4e888f072f7f0788da1f93d80c7bc86be4a (patch) | |
tree | 1ef9646d1e274c70c30625fad70df5521a3ebbb3 /synapse/federation/transport | |
parent | Fix the hierarchy of OpenID providers in the docs. (#10445) (diff) | |
download | synapse-590cc4e888f072f7f0788da1f93d80c7bc86be4a.tar.xz |
Add type hints to additional servlet functions (#10437)
Improves type hints for: * parse_{boolean,integer} * parse_{boolean,integer}_from_args * parse_json_{value,object}_from_request And fixes any incorrect calls that resulted from unknown types.
Diffstat (limited to 'synapse/federation/transport')
-rw-r--r-- | synapse/federation/transport/server.py | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/synapse/federation/transport/server.py b/synapse/federation/transport/server.py index 2974d4d0cc..5e059d6e09 100644 --- a/synapse/federation/transport/server.py +++ b/synapse/federation/transport/server.py @@ -984,7 +984,7 @@ class PublicRoomList(BaseFederationServlet): limit = parse_integer_from_args(query, "limit", 0) since_token = parse_string_from_args(query, "since", None) include_all_networks = parse_boolean_from_args( - query, "include_all_networks", False + query, "include_all_networks", default=False ) third_party_instance_id = parse_string_from_args( query, "third_party_instance_id", None @@ -1908,16 +1908,7 @@ class FederationSpaceSummaryServlet(BaseFederationServlet): suggested_only = parse_boolean_from_args(query, "suggested_only", default=False) max_rooms_per_space = parse_integer_from_args(query, "max_rooms_per_space") - exclude_rooms = [] - if b"exclude_rooms" in query: - try: - exclude_rooms = [ - room_id.decode("ascii") for room_id in query[b"exclude_rooms"] - ] - except Exception: - raise SynapseError( - 400, "Bad query parameter for exclude_rooms", Codes.INVALID_PARAM - ) + exclude_rooms = parse_strings_from_args(query, "exclude_rooms", default=[]) return 200, await self.handler.federation_space_summary( origin, room_id, suggested_only, max_rooms_per_space, exclude_rooms |