From e408e18fee0c4f50baaeb55e3b27c77a8f6fe464 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Tue, 24 May 2011 18:21:12 +0200 Subject: [PATCH] [alpertekinalp] Fix upper() function for ascii-only strings. Fixes #6888 --- src/common/xmpp/protocol.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/xmpp/protocol.py b/src/common/xmpp/protocol.py index 70027e647..45453310e 100644 --- a/src/common/xmpp/protocol.py +++ b/src/common/xmpp/protocol.py @@ -22,6 +22,12 @@ sub- stanzas) handling routines from simplexml import Node, NodeBuilder import time +import string + +def ascii_upper(s): + trans_table = string.maketrans(string.ascii_lowercase, + string.ascii_uppercase) + return s.translate(trans_table) NS_ACTIVITY = 'http://jabber.org/protocol/activity' # XEP-0108 NS_ADDRESS = 'http://jabber.org/protocol/address' # XEP-0033 @@ -209,7 +215,7 @@ xmpp_stream_error_conditions), (NS_STANZAS, 'ERR', xmpp_stanza_error_conditions) (NS_SASL, 'SASL', sasl_error_conditions)): for err in errpool.split('\n')[1:]: cond, code, typ, text = err.split(' -- ') - name = errname + '_' + cond.upper().replace('-', '_') + name = errname + '_' + ascii_upper(cond).replace('-', '_') locals()[name] = ns + ' ' + cond ERRORS[ns + ' ' + cond] = [code, typ, text] if code: