diff options
author | Paul "LeoNerd" Evans <paul@matrix.org> | 2015-01-27 16:17:56 +0000 |
---|---|---|
committer | Paul "LeoNerd" Evans <paul@matrix.org> | 2015-01-27 16:17:56 +0000 |
commit | 059651efa19a88eb0823bce1d5beff2d95cb01c2 (patch) | |
tree | 51f89ec0377a8c4ec3016938b15ba82cfb76b9c4 /synapse/rest/client | |
parent | Initial trivial unittest of Filtering object (diff) | |
download | synapse-059651efa19a88eb0823bce1d5beff2d95cb01c2.tar.xz |
Have the Filtering API return Deferreds, so we can do the Datastore implementation nicely
Diffstat (limited to 'synapse/rest/client')
-rw-r--r-- | synapse/rest/client/v2_alpha/filter.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/rest/client/v2_alpha/filter.py b/synapse/rest/client/v2_alpha/filter.py index 585c8e02e8..09e44e8ae0 100644 --- a/synapse/rest/client/v2_alpha/filter.py +++ b/synapse/rest/client/v2_alpha/filter.py @@ -54,10 +54,12 @@ class GetFilterRestServlet(RestServlet): raise SynapseError(400, "Invalid filter_id") try: - defer.returnValue((200, self.filtering.get_user_filter( + filter = yield self.filtering.get_user_filter( user_localpart=target_user.localpart, filter_id=filter_id, - ))) + ) + + defer.returnValue((200, filter)) except KeyError: raise SynapseError(400, "No such filter") @@ -89,7 +91,7 @@ class CreateFilterRestServlet(RestServlet): except: raise SynapseError(400, "Invalid filter definition") - filter_id = self.filtering.add_user_filter( + filter_id = yield self.filtering.add_user_filter( user_localpart=target_user.localpart, definition=content, ) |