Closed idavidmcdonald closed 6 years ago
Yeah this seems like a bug. Nulling a field should certainly be possible.
Adding a check for None
as a value in NestedMutable.coerce
seems like a decent solution, and follows the base pattern laid out in SQLAlchemy's Mutable
base type. A PR would be more than welcome.
Great, I'll put in a PR.
Would you like me to take care of a patch version bump or is this something you'd like to do separately?
Very simple PR up - https://github.com/edelooff/sqlalchemy-json/pull/11. Feel free to take a look and I'll be happy to add any further changes.
Thanks again.
I'll take care of the change log entry, version bump and new PyPI release when I have a bit of spare time.
@edelooff Would love to see a pypi release for this. Let me know if I can do anything to help.
@benvand https://pypi.org/project/sqlalchemy-json/ done, thanks for the request.
@edelooff it looks like this is still actual with https://pypi.org/project/sqlalchemy-json/0.5.0
If I have a JSON field, say
a_json
that has been associated withNestedMutable
I cannot set it's value asNone
without triggering anAttributeError
asNone
does not have thecoerce
attribute.For example:
I believe setting the value as
None
should be allowed and should be quite an easy one to fix. I'm happy to put in a PR if you agree this is sensible, just let me know.Thanks :)