From 8d67f20bccc8f06c9615b1f57bad31517c230d73 Mon Sep 17 00:00:00 2001 From: schlatterbeck Date: Thu, 8 Apr 2010 14:33:54 +0000 Subject: [PATCH] xmlrpc handling of unicode characters, see http://thread.gmane.org/gmane.comp.bug-tracking.roundup.user/10040 git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4475 57a73879-2fb5-44c3-a270-3262357dd7e2 --- CHANGES.txt | 2 ++ roundup/xmlrpc.py | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 2bf2c33..da26da8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,8 @@ are given with the most recent entry first. Fixed: - Handle multiple @action values from broken trackers. +- xmlrpc handling of unicode characters, see + http://thread.gmane.org/gmane.comp.bug-tracking.roundup.user/10040 2010-02-23 1.5.0 diff --git a/roundup/xmlrpc.py b/roundup/xmlrpc.py index b0495d0..88ddb34 100644 --- a/roundup/xmlrpc.py +++ b/roundup/xmlrpc.py @@ -34,10 +34,17 @@ def props_from_args(db, cl, args, itemid=None): for arg in args: if arg.find('=') == -1: raise UsageError, 'argument "%s" not propname=value'%arg - l = arg.split('=') - if len(l) < 2: + try : + key, value = arg.split('=', 1) + except ValueError : raise UsageError, 'argument "%s" not propname=value'%arg - key, value = l[0], '='.join(l[1:]) + if isinstance (key, unicode) : + try : + key = key.encode ('ascii') + except UnicodeEncodeError: + raise UsageError, 'argument %r is no valid ascii keyword'%key + if isinstance (value, unicode) : + value = value.encode ('utf-8') if value: try: props[key] = hyperdb.rawToHyperdb(db, cl, itemid, -- 2.30.2