[telepathy-gabble/master] Add a curried version of match_jingle_action

Will Thompson will.thompson at collabora.co.uk
Wed May 27 07:59:01 PDT 2009


jp.action_predicate('session-initiate') can be used directly as the
predicate of an EventPattern, rather than needing something like
lambda e: jp.match_jingle_action(e, 'session-initiate')
---
 tests/twisted/jingle/jingletest2.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/tests/twisted/jingle/jingletest2.py b/tests/twisted/jingle/jingletest2.py
index 2a56587..9b78b81 100644
--- a/tests/twisted/jingle/jingletest2.py
+++ b/tests/twisted/jingle/jingletest2.py
@@ -105,6 +105,12 @@ class JingleProtocol:
         "Creates <feature> element"
         return ('feature', None, { 'var': var }, [])
 
+    def action_predicate(self, action):
+        def f(e):
+            return self.match_jingle_action(e.query, action)
+
+        return f
+
     def match_jingle_action(self, q, action):
         return q is not None and q.name == 'jingle' and q['action'] == action
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list