Error with empty string in binary field

63 views
Skip to first unread message

Brian Cox

unread,
Nov 5, 2013, 11:34:54 AM11/5/13
to pytho...@googlegroups.com
Hi Christophe,

We've been running for a while with no issues, but had something come up that I hope you can help with.

We've got an optional binary field in a SOAP request. We can process the request with b64encode('<<data>>) passed in, or with None as the value. But trying to send an empty string fails with the following error:

2013-11-05T16:24:09.076860+00:00 localhost [ERROR/WebService] Server-side error: "must be string or buffer, not None". Detail:
Traceback (most recent call last):

  File "/usr/local/lib/python2.7/site-packages/WSME-0.4-py2.7.egg/wsme/root.py", line 173, in _do_call
    kw = protocol.read_arguments(context)

  File "/usr/local/lib/python2.7/site-packages/WSME_Soap-0.4.1-py2.7.egg/wsmeext/soap/protocol.py", line 329, in read_arguments
    arg = context.funcdef.get_arg(name)

  File "/usr/local/lib/python2.7/site-packages/simplegeneric-0.8.1-py2.7.egg/simplegeneric.py", line 67, in dispatch
    return f[1](*args, **kw)

  File "/usr/local/lib/python2.7/site-packages/WSME_Soap-0.4.1-py2.7.egg/wsmeext/soap/protocol.py", line 240, in binary_fromsoap
    if el.text == '' or el.text is None:

  File "/usr/local/lib/python2.7/base64.py", line 321, in decodestring
    return binascii.a2b_base64(s)

TypeError: must be string or buffer, not None

As you can see, we are still using 0.4.1 and are unable to upgrade at this time.

I've tried poking around in protocol.py, but none of my changes have had any effect.

Any ideas?

Thanks!
Brian

Christophe de Vienne

unread,
Dec 5, 2013, 2:59:08 PM12/5/13
to pytho...@googlegroups.com
Hello Brian,

I am very sorry, I just saw this message. I hope you are not stuck since
then.

If you still haven't solved your problem, try inserting the following
code at line 240 of wsmeext/soap/protocol.py :

if not el.text:
return wsme.types.bytes("")


When you say you are not able to upgrade, do you mean to 0.5 ? If it is
the case and you have a patch for wsme-soap 0.4.1 that solve your issue
I can release a 0.4.2 in a little while.

Cheers,

Christophe

Le 05/11/2013 17:34, Brian Cox a �crit :
> --
> You received this message because you are subscribed to the Google
> Groups "python-wsme" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to python-wsme...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Brian Cox

unread,
Dec 20, 2013, 12:28:01 PM12/20/13
to pytho...@googlegroups.com
Hi Christophe,

I finally got a chance to test this, and yes, it took care of our problem! Thanks for the help!

Correct, we aren't able to update to 0.5 yet, though I'm hoping to sometime after the first of the year.

Thanks again!
Brian


On Thursday, December 5, 2013 12:59:08 PM UTC-7, Christophe de Vienne wrote:
Hello Brian,

I am very sorry, I just saw this message. I hope you are not stuck since
then.

If you still haven't solved your problem, try inserting the following
code at line 240 of wsmeext/soap/protocol.py :

if not el.text:
    return wsme.types.bytes("")


When you say you are not able to upgrade, do you mean to 0.5 ? If it is
the case and you have a patch for wsme-soap 0.4.1 that solve your issue
I can release a 0.4.2 in a little while.

Cheers,

Christophe

Le 05/11/2013 17:34, Brian Cox a �crit :
Reply all
Reply to author
Forward
0 new messages