summary refs log tree commit diff
path: root/synapse/rest/client/v2_alpha
diff options
context:
space:
mode:
authorPablo Saavedra <psaavedra@igalia.com>2017-05-15 16:21:02 +0200
committerPablo Saavedra <psaavedra@igalia.com>2017-05-15 16:21:02 +0200
commit224137fcf98b424c6b5d1ab4b76c24b6213c7174 (patch)
treef0b2c1ed1b8091e41f54d95d2610450c9b942ef1 /synapse/rest/client/v2_alpha
parentFixed implementation errors (diff)
downloadsynapse-224137fcf98b424c6b5d1ab4b76c24b6213c7174.tar.xz
Fixed syntax nits
Diffstat (limited to 'synapse/rest/client/v2_alpha')
-rw-r--r--synapse/rest/client/v2_alpha/_base.py5
-rw-r--r--synapse/rest/client/v2_alpha/filter.py6
2 files changed, 6 insertions, 5 deletions
diff --git a/synapse/rest/client/v2_alpha/_base.py b/synapse/rest/client/v2_alpha/_base.py
index fd8f915655..1f5bc24cc3 100644
--- a/synapse/rest/client/v2_alpha/_base.py
+++ b/synapse/rest/client/v2_alpha/_base.py
@@ -52,9 +52,8 @@ def client_v2_patterns(path_regex, releases=(0,),
 def set_timeline_upper_limit(filter_json, filter_timeline_limit):
     if filter_timeline_limit < 0:
         return  # no upper limits
-    if 'room' in filter_json \
-            and 'timeline' in filter_json['room'] \
-            and 'limit' in filter_json['room']['timeline']:
+    timeline = filter_json.get('room', {}).get('timeline', {})
+    if 'limit' in timeline:
         filter_json['room']['timeline']["limit"] = min(
             filter_json['room']['timeline']['limit'],
             filter_timeline_limit)
diff --git a/synapse/rest/client/v2_alpha/filter.py b/synapse/rest/client/v2_alpha/filter.py
index 364d20d8e6..d2b2fd66e6 100644
--- a/synapse/rest/client/v2_alpha/filter.py
+++ b/synapse/rest/client/v2_alpha/filter.py
@@ -86,8 +86,10 @@ class CreateFilterRestServlet(RestServlet):
             raise AuthError(403, "Can only create filters for local users")
 
         content = parse_json_object_from_request(request)
-        set_timeline_upper_limit(content,
-                                 self.hs.config.filter_timeline_limit)
+        set_timeline_upper_limit(
+            content,
+            self.hs.config.filter_timeline_limit
+        )
 
         filter_id = yield self.filtering.add_user_filter(
             user_localpart=target_user.localpart,