add plone.api.content.update
@mauritsvanrees is already working on this.
Since Mar 27, 2017.
- Dominant language
- Python
- Stars
- 101
- Forks
- 62
- Avg merge
- 15h 15m
- Merged PRs (30d)
- 1
Description
i would like to see an update method, that really acts like updating (eg changing) using the mechanism used during a browser session.
inspiration:
i do have a package where i registered a custom method on the ObjectModifiedEvent.
during tests i create a structure of folders and pages using
plone.api.content.create(container, type, title, a_costum_field_from_my_behavior)
the method gets triggered -> container modified. so far, so good.
now i want to change the value of a_costum_field_from_my_behavior.
try 1:
self.portal.my-content-object.a_costum_field_from_my_behavior = new_value
-> no event triggered, not even after transaction.commit()
try 2:
z3c.form; get the field; update the value
-> no event triggered
try 3:
test browser; not what i wanted, as its not browser test, just a simple functional test. but itried at least -> no event triggered
thanks to @jensens i did it via zope.event.notify.
having to know was really hard work to get there and cost me several hours... i wouldn't even know how to search that (searching without knowing what to search is always hard)
thats why i would love to see an update method
plone.api.content.update(object, fields={field:value, field:value, ...})
which does the complete set of mechanisms done by plone in normal usage.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.