suds-community / suds

Suds is a lightweight SOAP python client for consuming Web Services. A community fork of the jurko fork.
https://suds.readthedocs.io/
GNU Lesser General Public License v3.0
173 stars 56 forks source link

PrimitiveAppender and TextAppender does not allow empty strings #107

Closed martin-pil closed 1 month ago

martin-pil commented 2 months ago

Hi

I'm wondering about the reason for that empty strings are not allowed to be set https://github.com/suds-community/suds/blob/master/suds/mx/appender.py#L179 https://github.com/suds-community/suds/blob/master/suds/mx/appender.py#L278

There are some API that I use that require that the attributes are in request and value can be an empty string to represent no value. If they are changed to "if value is not None:" would this cause problems?

phillbaker commented 2 months ago

I'm wondering about the reason

It's not clear, the git blame doesn't offer much context - it may be an oversight.

Since this is an Attribute: https://github.com/suds-community/suds/blob/049d2fcb7a1b14aab749992a803c2cfe551ef058/suds/mx/appender.py#L176

looking at the code for that class, it has an example of what you're describing:

https://github.com/suds-community/suds/blob/049d2fcb7a1b14aab749992a803c2cfe551ef058/suds/xsd/sxbasic.py#L692

If you'd like to submit a PR with that change and an update to the tests, I'll review it.