[Cmfcollectorng-cvs] CMFCollectorNG/Extensions Install.py,1.9.2.2,1.9.2.3
Status: Alpha
Brought to you by:
ajung
|
From: <aj...@us...> - 2003-03-31 13:35:11
|
Update of /cvsroot/cmfcollectorng/CMFCollectorNG/Extensions
In directory sc8-pr-cvs1:/tmp/cvs-serv1533
Modified Files:
Tag: V-0_20-branch
Install.py
Log Message:
added patch by Rocky Burt to support CMFInstaller
Index: Install.py
===================================================================
RCS file: /cvsroot/cmfcollectorng/CMFCollectorNG/Extensions/Install.py,v
retrieving revision 1.9.2.2
retrieving revision 1.9.2.3
diff -C2 -d -r1.9.2.2 -r1.9.2.3
*** Install.py 13 Mar 2003 08:33:33 -0000 1.9.2.2
--- Install.py 31 Mar 2003 13:34:45 -0000 1.9.2.3
***************
*** 35,38 ****
--- 35,39 ----
from Acquisition import aq_base
+ import os
def install(self):
***************
*** 53,56 ****
--- 54,58 ----
memberdata_tool = getToolByName(self, 'portal_memberdata')
catalog = getToolByName(self, 'portal_catalog')
+ workflow_tool = getToolByName(self, 'portal_workflow')
# add some new properties to memberdatatool
***************
*** 82,86 ****
# Setup the skins
# This is borrowed from CMFDefault/scripts/addImagesToSkinPaths.pys
! if 'collectorng' not in skins_tool.objectIds():
# We need to add Filesystem Directory Views for any directories
# in our skins/ directory. These directories should already be
--- 84,89 ----
# Setup the skins
# This is borrowed from CMFDefault/scripts/addImagesToSkinPaths.pys
! skinIds = skins_tool.objectIds()
! if 'collectorng' not in skinIds and 'collectorng1' not in skinIds:
# We need to add Filesystem Directory Views for any directories
# in our skins/ directory. These directories should already be
***************
*** 111,114 ****
--- 114,197 ----
+ filename='collectorng_issue_workflow.zexp'
+ src_path = self.getPhysicalRoot().Control_Panel.Products.CMFCollectorNG.home
+ src_file = open(os.path.join(src_path, 'import', filename), 'rb')
+ dest_file = open(os.path.join(INSTANCE_HOME, 'import', filename), 'wb')
+ dest_file.write(src_file.read())
+ src_file.close(); dest_file.close()
+
+ workflow_tool.manage_importObject(filename)
+
+ os.unlink(os.path.join(INSTANCE_HOME, 'import', filename))
+
+ workflow_tool.setChainForPortalTypes(('CollectorNG Issue',), 'collectorng_issue_workflow')
+
+ out.write("Added 'collectorng_issue_workflow' workflow\n")
+
return out.getvalue()
+
+ def uninstall(self):
+ """ Unregister the Collector with portal_types and friends """
+
+ assert self.meta_type == 'CMF Site'
+
+ self._delRoles(("TrackerAdmin", "Supporter", "Reporter"), None)
+
+ out = StringIO()
+ types_tool = getToolByName(self, 'portal_types')
+ skins_tool = getToolByName(self, 'portal_skins')
+ metadata_tool = getToolByName(self, 'portal_metadata')
+ memberdata_tool = getToolByName(self, 'portal_memberdata')
+ catalog = getToolByName(self, 'portal_catalog')
+ workflow_tool = getToolByName(self, 'portal_workflow')
+
+ properties = ('submitter_company', 'submitter_name',
+ 'submitter_address', 'submitter_send_attachments',
+ 'collector_substitute', 'submitter_phone')
+ memberdata_tool.manage_delProperties(properties)
+ out.write('Removed %s from memberdata_tool\n' % str(properties))
+
+ # we can't do this as CMFQuickInstaller will blow up
+ #for t in CMFCollectorNG.factory_type_information:
+ # if t['id'] in types_tool.objectIds():
+ # types_tool._delObject(t['id'])
+ # out.write('Unregistered %s with the types tool\n' % t['id'])
+ # else:
+ # out.write('Skipping "%s" - not registered in types tool\n' % t['id'])
+
+ # we can't do this as CMFQuickInstaller will blow up
+ #if 'collectorng' in skins_tool.objectIds():
+ # skins_tool.manage_delObjects(['collectorng'])
+ # out.write("Removed collectorng skin directory view from portal_skins\n")
+
+ # Now we need to go through the skin configurations and insert
+ # 'collector' into the configurations. Preferably, this should be
+ # right before where 'content' is placed. Otherwise, we append
+ # it to the end.
+ skins = skins_tool.getSkinSelections()
+
+ for skin in skins:
+ path = skins_tool.getSkinPath(skin)
+ path = [p.strip() for p in path.split(',')]
+
+ if 'collectorng' in path:
+ path.remove('collectorng')
+
+ path = ', '.join(path)
+ # addSkinSelection will replace exissting skins as well.
+ skins_tool.addSkinSelection(skin, path)
+ out.write("Removed 'collectorng' from %s skin\n" % skin)
+ else:
+ out.write("Skipping %s skin, 'collectorng' isn't added\n" % (
+ skin))
+
+
+ # we can't do this as CMFQuickInstaller will blow up
+ #if 'collectorng_issue_workflow' in workflow_tool.objectIds():
+ # workflow_tool.manage_delObjects(['collectorng_issue_workflow'])
+ # out.write("Removed collectorng_issue_workflow from portal_workflow\n")
+
+
+ return out.getvalue()
+
|