[Telepathy-commits] [telepathy-gabble/master] Make elements with namespace None not ''.

Will Thompson will.thompson at collabora.co.uk
Sun Mar 1 10:24:49 PST 2009


They're actually different: under certain circumstances, Element(('',
'badger')) will come out as <badger xmlns=''/> which is not what you
wanted. Gabble doesn't notice because LM isn't an XML parser, but Haze
did because libxml2 is.

Reviewed-by: Dafydd Harries <dafydd.harries at collabora.co.uk>
---
 tests/twisted/olpc/test-olpc-bundle.py             |    4 ++--
 tests/twisted/test-disco.py                        |    2 +-
 tests/twisted/text/destroy.py                      |    2 +-
 tests/twisted/text/initiate.py                     |    2 +-
 tests/twisted/text/respawn.py                      |    2 +-
 tests/twisted/text/send-error.py                   |    8 ++++----
 tests/twisted/text/test-text-delayed.py            |    2 +-
 tests/twisted/text/test-text-no-body.py            |    4 ++--
 tests/twisted/text/test-text.py                    |    2 +-
 ...offer-accept-private-stream-tube-si-fallback.py |    8 ++++----
 10 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/tests/twisted/olpc/test-olpc-bundle.py b/tests/twisted/olpc/test-olpc-bundle.py
index 84e5ea3..a0ea5e9 100644
--- a/tests/twisted/olpc/test-olpc-bundle.py
+++ b/tests/twisted/olpc/test-olpc-bundle.py
@@ -22,7 +22,7 @@ def test(q, bus, conn, stream):
     acknowledge_iq(stream, iq_event.stanza)
 
     # send diso request
-    m = domish.Element(('', 'iq'))
+    m = domish.Element((None, 'iq'))
     m['from'] = 'alice at jabber.laptop.org'
     m['id'] = '1'
     query = m.addElement('query')
@@ -52,7 +52,7 @@ def test(q, bus, conn, stream):
     assert len(c_nodes) == 1
 
     # send diso request
-    m = domish.Element(('', 'iq'))
+    m = domish.Element((None, 'iq'))
     m['from'] = 'alice at jabber.laptop.org'
     m['id'] = '2'
     query = m.addElement('query')
diff --git a/tests/twisted/test-disco.py b/tests/twisted/test-disco.py
index 9ebf30e..acf81b4 100644
--- a/tests/twisted/test-disco.py
+++ b/tests/twisted/test-disco.py
@@ -11,7 +11,7 @@ def test(q, bus, conn, stream):
     conn.Connect()
     q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
 
-    m = domish.Element(('', 'iq'))
+    m = domish.Element((None, 'iq'))
     m['from'] = 'foo at bar.com'
     m['id'] = '1'
     m.addElement(('http://jabber.org/protocol/disco#info', 'query'))
diff --git a/tests/twisted/text/destroy.py b/tests/twisted/text/destroy.py
index 20abc35..b3abb7f 100644
--- a/tests/twisted/text/destroy.py
+++ b/tests/twisted/text/destroy.py
@@ -88,7 +88,7 @@ def test(q, bus, conn, stream):
     assert body.children[0] == u'hey'
 
     # <message type="chat"><body>hello</body</message>
-    m = domish.Element(('', 'message'))
+    m = domish.Element((None, 'message'))
     m['from'] = 'foo at bar.com/Pidgin'
     m['type'] = 'chat'
     m.addElement('body', content='hello')
diff --git a/tests/twisted/text/initiate.py b/tests/twisted/text/initiate.py
index a2ac19a..78bfdba 100644
--- a/tests/twisted/text/initiate.py
+++ b/tests/twisted/text/initiate.py
@@ -75,7 +75,7 @@ def test(q, bus, conn, stream):
     assert body.children[0] == u'hey'
 
     # <message type="chat"><body>hello</body</message>
-    m = domish.Element(('', 'message'))
+    m = domish.Element((None, 'message'))
     m['from'] = 'foo at bar.com/Pidgin'
     m['type'] = 'chat'
     m.addElement('body', content='hello')
diff --git a/tests/twisted/text/respawn.py b/tests/twisted/text/respawn.py
index 0f48284..b924f03 100644
--- a/tests/twisted/text/respawn.py
+++ b/tests/twisted/text/respawn.py
@@ -85,7 +85,7 @@ def test(q, bus, conn, stream):
     assert body.children[0] == u'hey'
 
     # <message type="chat"><body>hello</body</message>
-    m = domish.Element(('', 'message'))
+    m = domish.Element((None, 'message'))
     m['from'] = 'foo at bar.com/Pidgin'
     m['type'] = 'chat'
     m.addElement('body', content='hello')
diff --git a/tests/twisted/text/send-error.py b/tests/twisted/text/send-error.py
index c315485..43c7f90 100644
--- a/tests/twisted/text/send-error.py
+++ b/tests/twisted/text/send-error.py
@@ -45,12 +45,12 @@ def test_temporary_error(q, bus, conn, stream):
     # </message>
     message_body = 'what is up, my good sir?'
 
-    m = domish.Element(('', 'message'))
+    m = domish.Element((None, 'message'))
     m['from'] = 'foo at bar.com'
     m['type'] = 'error'
     m.addElement('body', content=message_body)
 
-    e = domish.Element(('', 'error'))
+    e = domish.Element((None, 'error'))
     e['type'] = 'wait'
     e.addElement((ns.STANZA, 'resource-constraint'))
 
@@ -132,12 +132,12 @@ def test_permanent_error(q, bus, conn, stream):
     # </message>
     message_body = 'hello? is there anyone there?'
 
-    m = domish.Element(('', 'message'))
+    m = domish.Element((None, 'message'))
     m['from'] = 'wee at ninja.jp'
     m['type'] = 'error'
     m.addElement('body', content=message_body)
 
-    e = domish.Element(('', 'error'))
+    e = domish.Element((None, 'error'))
     e['type'] = 'cancel'
     e.addElement((ns.STANZA, 'item-not-found'))
 
diff --git a/tests/twisted/text/test-text-delayed.py b/tests/twisted/text/test-text-delayed.py
index c543044..b0ac215 100644
--- a/tests/twisted/text/test-text-delayed.py
+++ b/tests/twisted/text/test-text-delayed.py
@@ -14,7 +14,7 @@ def test(q, bus, conn, stream):
     conn.Connect()
     q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
 
-    m = domish.Element(('', 'message'))
+    m = domish.Element((None, 'message'))
     m['from'] = 'foo at bar.com'
     m['type'] = 'chat'
     m.addElement('body', content='hello')
diff --git a/tests/twisted/text/test-text-no-body.py b/tests/twisted/text/test-text-no-body.py
index 311be2f..eb8fcee 100644
--- a/tests/twisted/text/test-text-no-body.py
+++ b/tests/twisted/text/test-text-no-body.py
@@ -15,14 +15,14 @@ def test(q, bus, conn, stream):
     q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
 
     # message without body
-    m = domish.Element(('', 'message'))
+    m = domish.Element((None, 'message'))
     m['from'] = 'alice at foo.com'
     m['type'] = 'chat'
     m.addElement((ns.CHAT_STATES, 'composing'))
     stream.send(m)
 
     # message with body
-    m = domish.Element(('', 'message'))
+    m = domish.Element((None, 'message'))
     m['from'] = 'bob at foo.com'
     m['type'] = 'chat'
     m.addElement((ns.CHAT_STATES, 'active'))
diff --git a/tests/twisted/text/test-text.py b/tests/twisted/text/test-text.py
index 83f9e04..0c25499 100644
--- a/tests/twisted/text/test-text.py
+++ b/tests/twisted/text/test-text.py
@@ -15,7 +15,7 @@ def test(q, bus, conn, stream):
     q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
 
     # <message type="chat"><body>hello</body</message>
-    m = domish.Element(('', 'message'))
+    m = domish.Element((None, 'message'))
     m['from'] = 'foo at bar.com/Pidgin'
     m['type'] = 'chat'
     m.addElement('body', content='hello')
diff --git a/tests/twisted/tubes/offer-accept-private-stream-tube-si-fallback.py b/tests/twisted/tubes/offer-accept-private-stream-tube-si-fallback.py
index 15a365a..26615d9 100644
--- a/tests/twisted/tubes/offer-accept-private-stream-tube-si-fallback.py
+++ b/tests/twisted/tubes/offer-accept-private-stream-tube-si-fallback.py
@@ -282,11 +282,11 @@ def test(q, bus, conn, stream):
     res_si = result.addElement((ns.SI, 'si'))
     # reply using multi-bytestreams extension
     res_multi = res_si.addElement((ns.SI_MULTIPLE, 'si-multiple'))
-    res_value = res_multi.addElement(('', 'value'))
+    res_value = res_multi.addElement('value')
     res_value.addContent('invalid-stream-method')
-    res_value = res_multi.addElement(('', 'value'))
+    res_value = res_multi.addElement('value')
     res_value.addContent(ns.BYTESTREAMS)
-    res_value = res_multi.addElement(('', 'value'))
+    res_value = res_multi.addElement('value')
     res_value.addContent(ns.IBB)
 
     stream.send(result)
@@ -306,7 +306,7 @@ def test(q, bus, conn, stream):
     iq['to'] = 'test at localhost/Resource'
     iq['from'] = 'bob at localhost/Bob'
     iq['id'] = response_id
-    error = iq.addElement(('', 'error'))
+    error = iq.addElement('error')
     error['type'] = 'auth'
     error['code'] = '403'
     stream.send(iq)
-- 
1.5.6.5



More information about the telepathy-commits mailing list