GhitaB
GhitaB

Reputation: 3437

Reset profile version on uninstall add-on

I have a default profile containing some upgrade steps (1.0.0 -> 1.0.3). This is its metadata.xml:

<?xml version="1.0"?>
<metadata>
  <version>1.0.3</version>
  <dependencies>
    <dependency>profile-plone.app.dexterity:default</dependency>
  </dependencies>
</metadata>

I added an uninstall profile that removes the custom catalog added by default profile and so on.

So, I can Deactivate my add-on, Activate it and run again the Upgrades and all the configuration is fresh again.

How can I on uninstall to unset the profile version to something like 0.0.1 in order to get rid of manually running the upgrade steps again on reactivating the add-on? What I need is: with Deactivate + Activate the add-on to have all the configuration done, without going to portal_setup Upgrades, show old rerun...

Upvotes: 1

Views: 34

Answers (1)

GhitaB
GhitaB

Reputation: 3437

Solved adding post_handler on register profile (also simplified the upgrades steps - all in on now, metadata version: 1.1):

  <genericsetup:registerProfile
      name="default"
      title="my.addon"
      directory="profiles/default"
      description="Installs the package."
      provides="Products.GenericSetup.interfaces.EXTENSION"
      post_handler=".upgrades.evolve11.run"
      />

In upgrades.evolve11.run I have the code for configuring the catalog. So, reinstalling the add-on all needed operations are done.

Upvotes: 1

Related Questions