I'm looking for practical real-world code that already uses plone.api, but feels messy, feels not quite right.
Stuff like plone.api.content.find, instead of catalog = api.portal.get_tool(name='portal_catalog').
I assume you're also addressing gals, so here's my feedback: plone.api is one of the best things happened to Plone in its recent history, for the given reasonables and meets the setted goals, imho, congratulations! It is also very well documented, Chapeau. When it was fresh, it had a few bugs, but now I'm using it since some months regularly, mainly the find- and create-methods, as for example in adi.forumail no errors encountered Thanks a lot guys (the creators), for closing that gap. Best, Ida
plone.api is one of the best things happened to Plone in its recent history
Just idly, I'd like to reiterate this.
Although there are a few rough edges (no way to do an unrestricted traverse for example), this one package has literally lifted Plone development to a higher level.
Honestly, I would trade Plone 5 for more packages that were this good.
@jaroel Sorry, you didn't tag me so I didn't see this~
use-case for unrestricted traverse?
Consider the following use case:
User submits a form
The form response is saved in a folder called 'results' that is private.
In order to cater for client failures, process the form by:
Look to see if there is currently a folder called 'results'
If not, create the folder
Create a new Result in the folder
However, you have to use unrestrictedSearchResults() to be able to find the private folder; the api's find function won't find it.
Similarly, I've occasionally had to fetch a content object for various reasons, and had to fallback to unrestrictedGetObject to access and update an object which is technically private, but needs to be modified via anonymous user form input.
When hooking upon an event-listener and executing api.content.create I got "max. recursion exceeded", so I turned back to use invokeFactory, instead, which works fine. Same error occured with api.content.move.
What would the approach for adding the body text for Dexterity content be ? Can it be added straight away or does the content first need to be created and then the field can be edited?