summary refs log tree commit diff
path: root/synapse/api
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-01-30 14:54:06 +0000
committerMark Haines <mark.haines@matrix.org>2015-01-30 14:54:06 +0000
commite97f756a05519f9d5a8a6ff78182b691dd1355df (patch)
tree0666413e4e59ffe0b91bd3dea800718eff56f67d /synapse/api
parentUnused import (diff)
downloadsynapse-e97f756a05519f9d5a8a6ff78182b691dd1355df.tar.xz
Use 'in' to test if the key exists, remove unused _filters_for_user
Diffstat (limited to 'synapse/api')
-rw-r--r--synapse/api/filtering.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/synapse/api/filtering.py b/synapse/api/filtering.py
index fa4de2614d..4d570b74f8 100644
--- a/synapse/api/filtering.py
+++ b/synapse/api/filtering.py
@@ -114,21 +114,17 @@ class Filtering(object):
                     if not isinstance(event_type, basestring):
                         raise SynapseError(400, "Event type should be a string")
 
-        try:
+        if "format" in definition:
             event_format = definition["format"]
             if event_format not in ["federation", "events"]:
                 raise SynapseError(400, "Invalid format: %s" % (event_format,))
-        except KeyError:
-            pass  # format is optional
 
-        try:
+        if "select" in definition:
             event_select_list = definition["select"]
             for select_key in event_select_list:
                 if select_key not in ["event_id", "origin_server_ts",
                                       "thread_id", "content", "content.body"]:
                     raise SynapseError(400, "Bad select: %s" % (select_key,))
-        except KeyError:
-            pass  # select is optional
 
         if ("bundle_updates" in definition and
                 type(definition["bundle_updates"]) != bool):