deform
deform copied to clipboard
Add setitem, delitem to Field
Just for syntax sugar so you can del(form['something'])
or for multi part forms:
try:
appstruct = form['section'].validate_pstruct(pstruct['section'])
exceptValidationFailure as e:
form['something'] = e.field
return form.render()
Thank you for your pull request.
I am the new Deform project maintainer. I apologize the issue of this pull request not being commented earlier. Deform project is again under activate maintenance.
This is issue tracker / pull request clean to prepare a new release.
I am willing to merge this pull request. However to maintain the high standard of documentation in Pylons project I hope if you can cover this feature
- In API documentation or narrative documentation
- With the use case example why to use this and how to use
... and we are good to go!
As I am not the author of this feature or do not have prior discussion about the feature, I cannot document or communicate how it should be used.
If this is an abandon pull request and there is no new feedback I will close this pull request in 30 days.
Ping. Still interested to champion still pull request. If not I'll consider closing it.
It should already be documented in the API via the docstrings - is the api.rst not autogenerated?
Can you please add a documentation (either docstring or narrative)
-
This is the use case and this is why you want to do this
-
This is how you use it, with a code example
A good example is like one in the comment of this pull request, with little bit more background story, but it belongs to documentation not to the Github.
This is more to advertise the feature that people find it and know "hey I can do even this with Deform."
Hi @dourvaris, I've taken on the role of maintainer of Deform. I'd like to follow up on this PR and merge for release.
First if you have not already done so, would you please sign https://github.com/Pylons/deform/blob/master/CONTRIBUTORS.txt? I did not see your name in there.
Second, can you verify my understanding of this PR as follows? I would add this to the Deform narrative documentation.
Add to Common Needs
Given a declared Colander Schema and its creation:
class Person(colander.MappingSchema):
name = colander.SchemaNode(colander.String())
age = colander.SchemaNode(colander.Integer(),
validator=colander.Range(0, 200))
schema = Person()
You can set (add) or delete a Colander schema node as follows.
schema.__setitem__("eye_color")
schema.__delitem__("eye_color")
For convenience this PR implements these methods from Colander, but instead on the Deform form
object, as follows.
set(form["eye_color"])
del(form["eye_color"])
Finally, if it is not too much trouble, would you please rebase your PR on the master
branch and push those changes?
I look forward to your response. Thank you!