plone / plone/plone.api

add plone.api.content.update

Open
#363 4 comments 3 reactions 5 assignees View on GitHub

@mauritsvanrees is already working on this.

Since Mar 27, 2017.

03 type: feature (plip) 04 type: enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.