Mercurial > libervia-pubsub
diff idavoll/xmpp_error.py @ 156:6250905b72f6
Fix spacing errors. Do 0.5.0 release.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Mon, 28 Aug 2006 12:44:20 +0000 |
parents | 5191ba7c4df8 |
children |
line wrap: on
line diff
--- a/idavoll/xmpp_error.py Mon Aug 21 16:05:35 2006 +0000 +++ b/idavoll/xmpp_error.py Mon Aug 28 12:44:20 2006 +0000 @@ -4,32 +4,32 @@ NS_XMPP_STANZAS = "urn:ietf:params:xml:ns:xmpp-stanzas" conditions = { - 'bad-request': {'code': '400', 'type': 'modify'}, - 'not-authorized': {'code': '401', 'type': 'cancel'}, - 'item-not-found': {'code': '404', 'type': 'cancel'}, - 'not-acceptable': {'code': '406', 'type': 'modify'}, - 'conflict': {'code': '409', 'type': 'cancel'}, - 'internal-server-error': {'code': '500', 'type': 'wait'}, - 'feature-not-implemented': {'code': '501', 'type': 'cancel'}, - 'service-unavailable': {'code': '503', 'type': 'cancel'}, + 'bad-request': {'code': '400', 'type': 'modify'}, + 'not-authorized': {'code': '401', 'type': 'cancel'}, + 'item-not-found': {'code': '404', 'type': 'cancel'}, + 'not-acceptable': {'code': '406', 'type': 'modify'}, + 'conflict': {'code': '409', 'type': 'cancel'}, + 'internal-server-error': {'code': '500', 'type': 'wait'}, + 'feature-not-implemented': {'code': '501', 'type': 'cancel'}, + 'service-unavailable': {'code': '503', 'type': 'cancel'}, } def error_from_iq(iq, condition, text = '', type = None): - iq.swapAttributeValues("to", "from") - iq["type"] = 'error' - e = iq.addElement("error") + iq.swapAttributeValues("to", "from") + iq["type"] = 'error' + e = iq.addElement("error") - c = e.addElement((NS_XMPP_STANZAS, condition), NS_XMPP_STANZAS) + c = e.addElement((NS_XMPP_STANZAS, condition), NS_XMPP_STANZAS) - if type == None: - type = conditions[condition]['type'] + if type == None: + type = conditions[condition]['type'] - code = conditions[condition]['code'] + code = conditions[condition]['code'] - e["code"] = code - e["type"] = type + e["code"] = code + e["type"] = type - if text: - t = e.addElement((NS_XMPP_STANZAS, "text"), NS_XMPP_STANZAS, text) + if text: + t = e.addElement((NS_XMPP_STANZAS, "text"), NS_XMPP_STANZAS, text) - return iq + return iq