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
@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.