-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix exclude_if_none to do what it should #131
base: master
Are you sure you want to change the base?
Conversation
… properties with false to pass through. Also set default to True because it doesn't make sense to have nulls all over the place as default
thanks for the PR! for the first change this is a pretty big change and is somewhat in conflict with how we use the library so I'm not sure we'll be willing to override the default. Will let @dannyroberts weigh in though. The second change sounds good to me though again will defer to @dannyroberts . FYI, the first change wreaks havoc on the tests:
|
@KeithTsui thanks for the contribution. I think both of these changes have real merit, and I want to help get them in, but it's going to require a bit more than the basic implementation you've done here. As @czue noted, this library is heavily tested on exact inputs and outputs, and the changes you're suggesting are pretty far reaching. We aim heavily to be backwards compatible For both of your changes, I think there are good ways to make them backwards compatible. For (2), I would add an additional argument called BooleanProperty(exclude_if_is_none=True) current code using BooleanProperty(exclude_if_falsey=True) That's for (2). For (1) I suggest having someone who wants to override the default explicitly declare that at the beginning of their code. So that would look like: import jsonobject
jsonobject.configure_defaults(exclude_if_is_none=True) This would have to be called before any Then inside if exclude_if_is_none is None:
exclude_if_is_none = get_default_configuration().exclude_if_is_none Currently, neither Please, feel free to reach out for more information. If you're interested in taking on this larger task, I'd be happy to spend the time to make sure you're able to do it well and answer questions you might have along the way. |
Hi there, Thanks for all the prompt replies. I just found your library yesterday and I think for the second, it would be nice, but currently you guys have all For now I am just doing a really bad hack in my own files: Do you see that breaking anything with that? I'm happy to help with -Keith On Fri, Mar 18, 2016 at 9:43 AM, Daniel Roberts [email protected]
|
Hey @KeithTsui, I can't really comment on how well that'll work for you. Any functionality that we're committed to have working, we know works because of the test suite; without testing that, I can't say what edge cases might pop up. That said, if it works for you, go for it! Thanks again for the suggestion. This conversation will inform changes I make in the future to make this library more accessible and its behavior more predictable. Thanks for pointing out these quirks! |
Great library, but two things I wanted to address in the pull request:
Thanks!