[alpertekinalp] Fix upper() function for ascii-only strings. Fixes #6888

This commit is contained in:
Yann Leboulanger 2011-05-24 18:21:12 +02:00
parent 2a82a399a7
commit e408e18fee
1 changed files with 7 additions and 1 deletions

View File

@ -22,6 +22,12 @@ sub- stanzas) handling routines
from simplexml import Node, NodeBuilder from simplexml import Node, NodeBuilder
import time 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_ACTIVITY = 'http://jabber.org/protocol/activity' # XEP-0108
NS_ADDRESS = 'http://jabber.org/protocol/address' # XEP-0033 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)): (NS_SASL, 'SASL', sasl_error_conditions)):
for err in errpool.split('\n')[1:]: for err in errpool.split('\n')[1:]:
cond, code, typ, text = err.split(' -- ') cond, code, typ, text = err.split(' -- ')
name = errname + '_' + cond.upper().replace('-', '_') name = errname + '_' + ascii_upper(cond).replace('-', '_')
locals()[name] = ns + ' ' + cond locals()[name] = ns + ' ' + cond
ERRORS[ns + ' ' + cond] = [code, typ, text] ERRORS[ns + ' ' + cond] = [code, typ, text]
if code: if code: