Skip to content

Commit

Permalink
Merge 8b90128 into 63a7824
Browse files Browse the repository at this point in the history
  • Loading branch information
petschki committed Nov 5, 2019
2 parents 63a7824 + 8b90128 commit 0c01f13
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changes
2.0.0 (unreleased)
------------------

- add uninstall handler to cleanup persistent utilites and generated behaviors
[petschki]

- Fix GenericSetup import/export in python3
[erral]

Expand Down
1 change: 1 addition & 0 deletions src/collective/taxonomy/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
directory="profiles/uninstall"
description="Uninstall profile."
provides="Products.GenericSetup.interfaces.EXTENSION"
post_handler=".setuphandlers.uninstall"
/>

<genericsetup:importStep
Expand Down
16 changes: 16 additions & 0 deletions src/collective/taxonomy/setuphandlers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- conding: utf-8 -*-
from collective.taxonomy.interfaces import ITaxonomy
from zope.component.hooks import getSite
from zope.i18n.interfaces import ITranslationDomain
from zope.schema.interfaces import IVocabularyFactory


def uninstall(context):
sm = getSite().getSiteManager()
utilities = sm.getUtilitiesFor(ITaxonomy)

for uname, utility in utilities:
utility.unregisterBehavior()
sm.unregisterUtility(utility, ITaxonomy, name=uname)
sm.unregisterUtility(utility, IVocabularyFactory, name=uname)
sm.unregisterUtility(utility, ITranslationDomain, name=uname)

0 comments on commit 0c01f13

Please sign in to comment.