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

add plone.api.content.update #363

Open
iham opened this issue Mar 27, 2017 · 4 comments
Open

add plone.api.content.update #363

iham opened this issue Mar 27, 2017 · 4 comments

Comments

@iham
Copy link
Member

iham commented Mar 27, 2017

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.

@iham
Copy link
Member Author

iham commented Mar 27, 2017

maybe a list of objects would be nicer, for batch processing stuff, if wanted...

p.a.c.update(objects <list,tuple>, fields>dict)

@pigeonflight
Copy link
Member

Is this still something being considered?

@iham
Copy link
Member Author

iham commented Jan 9, 2018

it still is, afaik

@iham iham mentioned this issue Jan 18, 2019
13 tasks
@jaroel
Copy link
Member

jaroel commented Feb 8, 2019

Sounds alike awesome idea!
Keep in mind that different behaviors can define the same field. ie IBehav1.foobar and IBehav2.foobar.

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

No branches or pull requests

7 participants