Generic setup, 'pre-handler'

is there a way to do a 'pre-handler' with generic setups, similar to

post_handler=".setuphandlers.post_install"

But before ?

(or is the only option to make more profile(s) and a dependency metadata.xml ?)

What is your use case?

  1. Content type needs to be installed, folder and Collections need to be installed, criteria on Collection needs to be the content type, portlet needs to be installed on Collection,

The folders / content is made (with plone.api) in a setuphandler, so I need at least to "run" 'portlets.xml' after that.

..and all of this can only be done properly after your site up with all dependencies and all configurations have been installed properly. There is no valid use case for such a thing as a pre-handler.

How?

If portlets for content items are installed with portlets.xml and content is added in setuphandler script, the profile with portlets.xml needs to run 'last' to be assigned to '/some_folder/something (?)

The only approach I can think of is:

  1. /profiles/default
  2. /profiles/install_content
  3. dependecy of 'profiles/install_content in metadata.xml
  4. setuphandler (in /profiles/default) to install content

Or am I missing something here ?

You can also create content - if needed - using GenericSetup.

I am the one who added post_handler to GenericSetup in 2016, see this PR. And this same PR introduces pre_handler, which works exactly the same as post_handler. The order is:

  • Run the pre_handler, if available.
  • Run the import steps.
  • Run the post_handler, if available.
1 Like

Thanks a lot