Skip to content

Commit 37fc212

Browse files
author
Ralf Schlatterbeck
committed
- fix coding style from yesterday
- Allow encoding of parameters as "Binary" (this is encoded as base64 in xmlrpc). Example: s.create("file", "name=bla", "type=application/octet-stream", xmlrpclib.Binary("content=\0"))
1 parent e3cd4be commit 37fc212

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

roundup/xmlrpc.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from roundup.date import Date, Range, Interval
1111
from roundup import actions
1212
from SimpleXMLRPCServer import *
13+
from xmlrpclib import Binary
1314

1415
def translate(value):
1516
"""Translate value to becomes valid for XMLRPC transmission."""
@@ -32,19 +33,19 @@ def props_from_args(db, cl, args, itemid=None):
3233

3334
props = {}
3435
for arg in args:
35-
if arg.find('=') == -1:
36-
raise UsageError, 'argument "%s" not propname=value'%arg
36+
if isinstance(arg, Binary):
37+
arg = arg.data
3738
try :
3839
key, value = arg.split('=', 1)
3940
except ValueError :
4041
raise UsageError, 'argument "%s" not propname=value'%arg
41-
if isinstance (key, unicode) :
42-
try :
42+
if isinstance(key, unicode):
43+
try:
4344
key = key.encode ('ascii')
4445
except UnicodeEncodeError:
4546
raise UsageError, 'argument %r is no valid ascii keyword'%key
46-
if isinstance (value, unicode) :
47-
value = value.encode ('utf-8')
47+
if isinstance(value, unicode):
48+
value = value.encode('utf-8')
4849
if value:
4950
try:
5051
props[key] = hyperdb.rawToHyperdb(db, cl, itemid,

0 commit comments

Comments
 (0)