diff idavoll/xmpp_error.py @ 6:76efc9114469

Code cleanup
author Ralph Meijer <ralphm@ik.nu>
date Sun, 27 Jun 2004 15:07:11 +0000
parents 32e1561cd68e
children 226a97dd79ff
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