[Telepathy-commits] [telepathy-gabble/master] add xpath_query and valid_types to OLPC's util.py test helper file so parse_properties can be actually used

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Sep 26 04:45:30 PDT 2008


---
 tests/twisted/olpc/util.py |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/tests/twisted/olpc/util.py b/tests/twisted/olpc/util.py
index 8a01ea3..2c1ba37 100644
--- a/tests/twisted/olpc/util.py
+++ b/tests/twisted/olpc/util.py
@@ -19,6 +19,8 @@ NS_AMP = "http://jabber.org/protocol/amp"
 NS_STANZA = "urn:ietf:params:xml:ns:xmpp-stanzas"
 
 # Copied from Gadget
+valid_types = ['str', 'int', 'uint', 'bool', 'bytes']
+
 def parse_properties(elems):
     properties = {}
 
@@ -200,3 +202,12 @@ def request_random_activity_view(q, stream, conn, max, id, activities):
     send_reply_to_activity_view_request(stream, iq_event.stanza, activities)
 
     return return_event.value[0]
+
+# copied from Gadget
+def xpath_query(query, elem):
+    nodes = xpath.queryForNodes(query, elem)
+
+    if nodes is None:
+        return []
+    else:
+        return nodes
-- 
1.5.6.5




More information about the Telepathy-commits mailing list