Skip to content

Commit ec354ba

Browse files
author
Kevin D Smith
committed
Improve support for binary parameters and outputs
1 parent dddd4f4 commit ec354ba

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

swat/cas/connection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,8 @@ def _merge_param_args(self, parmlist, kwargs, action=None):
10351035
param['value'] = kwargs[param['name']].replace('"', '\\u0022')
10361036
# TODO: This should only happen for binary inputs (i.e., never)
10371037
elif isinstance(kwargs[param['name']], binary_types):
1038-
param['value'] = kwargs[param['name']].replace('"', '\\u0022')
1038+
# param['value'] = kwargs[param['name']].replace('"', '\\u0022')
1039+
pass
10391040
else:
10401041
param['value'] = kwargs[param['name']]
10411042

swat/cas/rest/value.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import base64
2727
from .table import REST_CASTable
28+
from ..types import blob
2829
from ...utils.compat import (a2u, int32, int64, float64, text_types,
2930
binary_types, int32_types, int64_types,
3031
float64_types, items_types)
@@ -38,7 +39,7 @@ def _value2python(_value, soptions, errors, connection,
3839
if _value.get('_ctb'):
3940
return ctb2tabular(REST_CASTable(_value), soptions, connection)
4041
elif sorted(_value.keys()) == ['data', 'length']:
41-
return base64.b64decode(_value['data'])
42+
return blob(base64.b64decode(_value['data']))
4243

4344
# Short circuit reflection data
4445
if 'actions' in _value and _value.get('actions', [{}])[0].get('params', False):

swat/cas/transformers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def ctb2tabular(_sw_table, soptions='', connection=None):
399399
'int64': lambda _sw_v, soptions, echk, conn: echk(_sw_v.getInt64(), _sw_v),
400400
'double': lambda _sw_v, soptions, echk, conn: echk(_sw_v.getDouble(), _sw_v),
401401
'blob': lambda _sw_v, soptions, echk, conn:
402-
base64.b64decode(echk(_sw_v.getBlobBase64(), _sw_v)),
402+
blob(base64.b64decode(echk(_sw_v.getBlobBase64(), _sw_v))),
403403
'string': lambda _sw_v, soptions, echk, conn:
404404
echk(a2u(_sw_v.getString(), 'utf-8'), _sw_v),
405405
'boolean': lambda _sw_v, soptions, echk, conn:

0 commit comments

Comments
 (0)