# HG changeset patch # User Ralph Meijer # Date 1088348831 0 # Node ID 76efc9114469c4e06d37725f639c0e37611dcb9e # Parent 05a5d412e1b164482db0c5f9f927ce7a98edc040 Code cleanup diff -r 05a5d412e1b1 -r 76efc9114469 idavoll/xmpp_error.py --- 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