[Telepathy-commits] [telepathy-gabble/master] olpc/util.py: _make_pubsub_event_msg: use elem() API
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Fri Sep 26 10:02:41 PDT 2008
20080703132331-7fe3f-8c4810fb03e763adbbf1b5c128e5fbb206a2b414.gz
---
tests/twisted/olpc/util.py | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/tests/twisted/olpc/util.py b/tests/twisted/olpc/util.py
index f456439..29659d1 100644
--- a/tests/twisted/olpc/util.py
+++ b/tests/twisted/olpc/util.py
@@ -77,16 +77,12 @@ def announce_gadget(q, stream, disco_stanza):
stream.send(reply)
def _make_pubsub_event_msg(from_, node):
- # TODO: Would be cool to use elem() but there is no API
- # to get a pointer on the item node...
- message = domish.Element(('jabber:client', 'message'))
- message['from'] = from_
- message['to'] = 'test at localhost'
- event = message.addElement(("%s#event" % NS_PUBSUB, 'event'))
-
- items = event.addElement((None, 'items'))
- items['node'] = node
- item = items.addElement((None, 'item'))
+ # manually create the item node as we need a ref on it
+ item = domish.Element((None, 'item'))
+
+ message = elem('message', from_=from_, to='test at localhost')(
+ elem("%s#event" % NS_PUBSUB, 'event')(
+ elem('items')(item)))
return message, item
--
1.5.6.5
More information about the Telepathy-commits
mailing list