changeset 6:76efc9114469

Code cleanup
author Ralph Meijer <ralphm@ik.nu>
date Sun, 27 Jun 2004 15:07:11 +0000
parents 05a5d412e1b1
children a8cfb31dc50c
files idavoll/xmpp_error.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/idavoll/xmpp_error.py	Sun Jun 27 14:09:17 2004 +0000
+++ b/idavoll/xmpp_error.py	Sun Jun 27 15:07:11 2004 +0000
@@ -1,3 +1,5 @@
+NS_XMPP_STANZAS = "urn:ietf:params:xml:ns:xmpp-stanzas"
+
 conditions = {
 	'bad-request':				{'code': '400', 'type': 'modify'},
 	'not-authorized':			{'code': '401', 'type': 'cancel'},
@@ -10,8 +12,7 @@
 	iq["type"] = 'error'
 	e = iq.addElement("error")
 
-	c = e.addElement(condition)
-	c["xmlns"] = "urn:ietf:params:xml:ns:xmpp-stanzas"
+	c = e.addElement((NS_XMPP_STANZAS, condition), NS_XMPP_STANZAS)
 
 	if type == None:
 		type = conditions[condition]['type']
@@ -22,7 +23,6 @@
 	e["type"] = type
 
 	if text:
-		t = e.addElement("text", None, text)
-		t["xmlns"] = "urn:ietf:params:xml:ns:xmpp-stanzas"
+		t = e.addElement((NS_XMPP_STANZAS, "text"), NS_XMPP_STANZAS, text)
 
 	return iq