Allow blank for all string types (url, email, ...) on dumping too
See original GitHub issueallow_blank
works only on load for fields.URL
or fields.Email
not dump:
from marshmallow import Schema, fields
class Test(Schema):
url = fields.URL(allow_blank=True)
# '2.0.0-dev'
Test().dump({'url': ''})
returns:
MarshalResult(data={u'url': None}, errors={u'url': [u'"" is not a valid URL.']})
I think it should return:
MarshalResult(data={u'url': u''}, errors={})
Issue Analytics
- State:
- Created 9 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Fields — marshmallow 3.19.0 documentation
Allows you to replace nested data with one of the data's fields. ... If an empty set, any non-falsy value will deserialize to...
Read more >URL filter - Fortinet Documentation Library
URL filter is also called static URL filter. By adding specific URLs with patterns containing text and regular expressions, FortiGate can allow, block,...
Read more >Postfix Configuration Parameters
The Postfix main.cf configuration file specifies a very small subset of all the parameters that control the operation of the Postfix mail system....
Read more >Cannot bind argument to parameter because it is an empty ...
Probably a late answer, but in case others have a similar issue. In my case, it was an array of strings. It was...
Read more >curl.1 the man page
You can specify any amount of URLs on the command line. ... "HOST2" and "PORT2" may also be the empty string, meaning "use...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just found this PR: https://github.com/marshmallow-code/marshmallow/issues/167
But the change to remove allow_blank is missing from the changelog here: http://marshmallow.readthedocs.io/en/latest/changelog.html#changelog - would probably be helpful. (I was on 2.3 and used allow_blank extensively, this now just failed silently).
Marshmallow 3.x no longer validates on dump, so the original issue no longer applies. https://github.com/marshmallow-code/marshmallow/issues/713 is a similar use case, and includes some examples that could work around this in marshmallow 2.x.