Last active
August 29, 2015 14:08
-
-
Save fulv/29fcb12e55ab98b93e94 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/plonesocial/network/Extensions/Install.py b/plonesocial/network/Extensions/Install.py | |
new file mode 100644 | |
index 0000000..af15c80 | |
--- /dev/null | |
+++ b/plonesocial/network/Extensions/Install.py | |
@@ -0,0 +1,7 @@ | |
+from Products.CMFCore.utils import getToolByName | |
+ | |
+ | |
+def uninstall(self, reinstall=False): | |
+ if not reinstall: | |
+ ps = getToolByName(self, 'portal_setup') | |
+ ps.runAllImportStepsFromProfile('profile-plonesocial.network:uninstall') # noqa | |
diff --git a/plonesocial/network/Extensions/__init__.py b/plonesocial/network/Extensions/__init__.py | |
new file mode 100644 | |
index 0000000..e69de29 | |
diff --git a/plonesocial/network/configure.zcml b/plonesocial/network/configure.zcml | |
index d7303c5..40fd2fc 100644 | |
--- a/plonesocial/network/configure.zcml | |
+++ b/plonesocial/network/configure.zcml | |
@@ -20,4 +20,13 @@ | |
i18n:attributes="title; description" | |
/> | |
+ <genericsetup:registerProfile | |
+ name="uninstall" | |
+ title="PloneSocial Network Uninstall" | |
+ directory="profiles/uninstall" | |
+ description="Uninstalls the plonesocial.network package" | |
+ provides="Products.GenericSetup.interfaces.EXTENSION" | |
+ i18n:attributes="title; description" | |
+ /> | |
+ | |
</configure> | |
diff --git a/plonesocial/network/profiles/uninstall/cssregistry.xml b/plonesocial/network/profiles/uninstall/cssregistry.xml | |
new file mode 100644 | |
index 0000000..c4f7879 | |
--- /dev/null | |
+++ b/plonesocial/network/profiles/uninstall/cssregistry.xml | |
@@ -0,0 +1,10 @@ | |
+<?xml version="1.0"?> | |
+<!-- This file holds the uninstall configuration for the portal_css tool. --> | |
+ | |
+<object name="portal_css"> | |
+ | |
+ <stylesheet title="" | |
+ id="++resource++plonesocial.network.stylesheets/plonesocial_network.css" | |
+ remove="True" /> | |
+ | |
+</object> | |
diff --git a/plonesocial/network/tests/test_setup.py b/plonesocial/network/tests/test_setup.py | |
index f9e6414..16f1d8d 100644 | |
--- a/plonesocial/network/tests/test_setup.py | |
+++ b/plonesocial/network/tests/test_setup.py | |
@@ -11,6 +11,8 @@ CSS = ( | |
'++resource++plonesocial.network.stylesheets/plonesocial_network.css', | |
) | |
+REGISTRY_ID = 'plone.resources/resource-plonesocial-network-stylesheets.css' | |
+ | |
class TestInstall(unittest.TestCase): | |
@@ -28,7 +30,10 @@ class TestInstall(unittest.TestCase): | |
self.assertIn('IPlonesocialNetworkLayer', layers) | |
def test_cssregistry(self): | |
- resource_ids = self.portal.portal_css.getResourceIds() | |
+ # resource_ids = self.portal.portal_css.getResourceIds() | |
+ # for id in CSS: | |
+ # self.assertIn(id, resource_ids, '{0} not installed'.format(id)) | |
+ resource_ids = api.portal.get_registry_record(REGISTRY_ID) | |
for id in CSS: | |
self.assertIn(id, resource_ids, '{0} not installed'.format(id)) | |
@@ -51,6 +56,6 @@ class TestUninstall(unittest.TestCase): | |
self.assertNotIn('IPlonesocialNetworkLayer', layers) | |
def test_cssregistry_removed(self): | |
- resource_ids = self.portal.portal_css.getResourceIds() | |
+ resource_ids = api.portal.get_registry_record(REGISTRY_ID) | |
for id in CSS: | |
self.assertNotIn(id, resource_ids, '{0} not removed'.format(id)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment