Skip to content
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

No mention in docs about using default=colander.drop #237

Closed
tisdall opened this issue Jun 25, 2015 · 10 comments
Closed

No mention in docs about using default=colander.drop #237

tisdall opened this issue Jun 25, 2015 · 10 comments

Comments

@tisdall
Copy link
Contributor

tisdall commented Jun 25, 2015

You can apparently use a colander.drop as a value for default, but there's no mention in the documents.

Example:

>>> x = colander.SchemaNode(
...     colander.Mapping(),
...     colander.SchemaNode(colander.String(), name="y")
... )
>>> x.serialize({'y':3})
{'y': '3'}
>>> x.serialize({})
{'y': <colander.null>}
>>> x = colander.SchemaNode(
...     colander.Mapping(),
...     colander.SchemaNode(colander.String(), name="y", default=colander.drop)
... )
>>> x.serialize({})
{}

Now, I find this feature very useful for what I'm working on. However, before I work on updating the docs to mention how this works, does anyone have any reasons for this to be labelled a bug?

@tisdall
Copy link
Contributor Author

tisdall commented Jul 2, 2015

Okay, it seems that this is mentioned in the CHANGES.rst but no one has updated the documentation.

@tonthon
Copy link

tonthon commented Dec 1, 2015

colander.drop should be used as value for missing, not default
http://docs.pylonsproject.org/projects/colander/en/latest/api.html#colander.SchemaNode

missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during serialization/deserialization.

@tisdall
Copy link
Contributor Author

tisdall commented Dec 1, 2015

@tonthon
Copy link

tonthon commented Dec 2, 2015

@tisdall - Oh I missed that one, I didn't know colander.drop could be used that way. Thanks for pointing it.

@tisdall
Copy link
Contributor Author

tisdall commented Dec 2, 2015

@tonthon, and do you know why you didn't know? Because it's not in the docs!

@stevepiercy
Copy link
Member

Is there a PR that closes this issue? I can merge a PR for the docs only, but not code as I don't have the necessary familiarity.

@tisdall
Copy link
Contributor Author

tisdall commented Dec 3, 2015

@stevepiercy #238 is sort-of docs only... ^_^ But, no, I haven't made anything to update the docs regarding this. I'm not working with colander right now so I likely won't be submitting a PR either so it's open for someone to contribute.

@mmerickel
Copy link
Member

A PR improving the docs for this feature is likely to be accepted. Any movement on this?

@lmctv
Copy link
Contributor

lmctv commented Jan 17, 2016

Forgot to put a reference to this issue in the pull request #248

@tisdall
Copy link
Contributor Author

tisdall commented Jan 18, 2016

fixed in #248

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants