Mercurial > p > roundup > code
comparison roundup/xmlrpc.py @ 4369:2188c9de5bdd
xmlrpc handling of unicode characters, see
http://thread.gmane.org/gmane.comp.bug-tracking.roundup.user/10040
| author | Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net> |
|---|---|
| date | Thu, 08 Apr 2010 14:33:54 +0000 |
| parents | 7291130fad82 |
| children | 40d7414592ac |
comparison
equal
deleted
inserted
replaced
| 4368:f4a863d88a99 | 4369:2188c9de5bdd |
|---|---|
| 32 | 32 |
| 33 props = {} | 33 props = {} |
| 34 for arg in args: | 34 for arg in args: |
| 35 if arg.find('=') == -1: | 35 if arg.find('=') == -1: |
| 36 raise UsageError, 'argument "%s" not propname=value'%arg | 36 raise UsageError, 'argument "%s" not propname=value'%arg |
| 37 l = arg.split('=') | 37 try : |
| 38 if len(l) < 2: | 38 key, value = arg.split('=', 1) |
| 39 except ValueError : | |
| 39 raise UsageError, 'argument "%s" not propname=value'%arg | 40 raise UsageError, 'argument "%s" not propname=value'%arg |
| 40 key, value = l[0], '='.join(l[1:]) | 41 if isinstance (key, unicode) : |
| 42 try : | |
| 43 key = key.encode ('ascii') | |
| 44 except UnicodeEncodeError: | |
| 45 raise UsageError, 'argument %r is no valid ascii keyword'%key | |
| 46 if isinstance (value, unicode) : | |
| 47 value = value.encode ('utf-8') | |
| 41 if value: | 48 if value: |
| 42 try: | 49 try: |
| 43 props[key] = hyperdb.rawToHyperdb(db, cl, itemid, | 50 props[key] = hyperdb.rawToHyperdb(db, cl, itemid, |
| 44 key, value) | 51 key, value) |
| 45 except hyperdb.HyperdbValueError, message: | 52 except hyperdb.HyperdbValueError, message: |
