Back to index

plone3  3.1.7
Install.py
Go to the documentation of this file.
00001 # -*- coding: utf-8 -*-
00002 ## CMFPlacefulWorkflow
00003 ## Copyright (C)2005 Ingeniweb
00004 
00005 ## This program is free software; you can redistribute it and/or modify
00006 ## it under the terms of the GNU General Public License as published by
00007 ## the Free Software Foundation; either version 2 of the License, or
00008 ## (at your option) any later version.
00009 
00010 ## This program is distributed in the hope that it will be useful,
00011 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 ## GNU General Public License for more details.
00014 
00015 ## You should have received a copy of the GNU General Public License
00016 ## along with this program; see the file COPYING. If not, write to the
00017 ## Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 """
00019 Product installation
00020 """
00021 __version__ = "$Revision: 61118 $"
00022 # $Source: /cvsroot/ingeniweb/CMFPlacefulWorkflow/Extensions/Install.py,v $
00023 # $Id: Install.py 61118 2008-03-25 13:50:21Z encolpe $
00024 __docformat__ = 'restructuredtext'
00025 
00026 from cStringIO import StringIO
00027 
00028 from zope.component import getSiteManager
00029 from zope.interface import noLongerProvides
00030 
00031 from Products.CMFPlacefulWorkflow.interfaces import IPlacefulMarker
00032 from Products.CMFPlacefulWorkflow.global_symbols import PROJECTNAME
00033 from Products.CMFPlacefulWorkflow.global_symbols import placeful_prefs_configlet
00034 from Products.CMFCore.utils import getToolByName
00035 from Products.CMFPlacefulWorkflow.interfaces import IPlacefulWorkflowTool
00036 
00037 
00038 def uninstall(self, reinstall=False, out=None):
00039     if out is None:
00040         out = StringIO()
00041 
00042     getSiteManager(self).unregisterUtility(self['portal_placeful_workflow'],
00043                                            IPlacefulWorkflowTool)
00044     # uninstall configlets
00045     try:
00046         cptool = getToolByName(self, 'portal_controlpanel')
00047         cptool.unregisterConfiglet(placeful_prefs_configlet['id'])
00048         out.write('Removing CMFPlacefulWorkflow Configlet')
00049     except:
00050         out.write('Failed to remove CMFPlacefulWorkflow Configlet')
00051 
00052     wf_tool = getToolByName(self, 'portal_workflow')
00053     if IPlacefulMarker.providedBy(wf_tool):
00054         noLongerProvides(wf_tool, IPlacefulMarker)
00055 
00056     return out.getvalue()