# -*- coding: utf-8 -*- # # File: TeleServices.py # # Copyright (c) 2007 by CommunesPlone # Generator: ArchGenXML Version 1.5.3 dev/svn # http://plone.org/products/archgenxml # # GNU General Public License (GPL) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # __author__ = """Gauthier BASTIEN , Stephan GEULETTE """ __docformat__ = 'plaintext' from Products.CMFCore.utils import getToolByName from Products.ExternalMethod.ExternalMethod import ExternalMethod ##code-section module-header #fill in your manual code here ##/code-section module-header def installWorkflows(self, package, out): """Install the custom workflows for this product.""" productname = 'TeleServices' workflowTool = getToolByName(self, 'portal_workflow') ourProductWorkflow = ExternalMethod('temp', 'temp', productname+'.'+'workteleservices_workflow', 'createworkteleservices_workflow') workflow = ourProductWorkflow(self, 'workteleservices_workflow') if workflow.getId() in workflowTool.listWorkflows(): print >> out, '%s already in workflows.' % workflow.getId() else: try: # plone 2.x workflowTool._setObject('workteleservices_workflow', workflow) except: # works in Plone 3.0, but isnt perfect! use ArchGenXML 2.0 for a # better result! workflowTool._setOb('workteleservices_workflow', workflow) print >> out, '%s added in workflows.' % workflow.getId() workflowTool.setChainForPortalTypes(['WorkTeleService', 'WorkTeleService'], workflow.getId()) ourProductWorkflow = ExternalMethod('temp', 'temp', productname+'.'+'populationteleservices_workflow', 'createpopulationteleservices_workflow') workflow = ourProductWorkflow(self, 'populationteleservices_workflow') if workflow.getId() in workflowTool.listWorkflows(): print >> out, '%s already in workflows.' % workflow.getId() else: try: # plone 2.x workflowTool._setObject('populationteleservices_workflow', workflow) except: # works in Plone 3.0, but isnt perfect! use ArchGenXML 2.0 for a # better result! workflowTool._setOb('populationteleservices_workflow', workflow) print >> out, '%s added in workflows.' % workflow.getId() workflowTool.setChainForPortalTypes(['PopulationTeleService', 'PopulationTeleService'], workflow.getId()) ourProductWorkflow = ExternalMethod('temp', 'temp', productname+'.'+'demandtypeterm_workflow', 'createdemandtypeterm_workflow') workflow = ourProductWorkflow(self, 'demandtypeterm_workflow') if workflow.getId() in workflowTool.listWorkflows(): print >> out, '%s already in workflows.' % workflow.getId() else: try: # plone 2.x workflowTool._setObject('demandtypeterm_workflow', workflow) except: # works in Plone 3.0, but isnt perfect! use ArchGenXML 2.0 for a # better result! workflowTool._setOb('demandtypeterm_workflow', workflow) print >> out, '%s added in workflows.' % workflow.getId() workflowTool.setChainForPortalTypes(['DemandTypeTerm'], workflow.getId()) ourProductWorkflow = ExternalMethod('temp', 'temp', productname+'.'+'term_workflow', 'createterm_workflow') workflow = ourProductWorkflow(self, 'term_workflow') if workflow.getId() in workflowTool.listWorkflows(): print >> out, '%s already in workflows.' % workflow.getId() else: try: # plone 2.x workflowTool._setObject('term_workflow', workflow) except: # works in Plone 3.0, but isnt perfect! use ArchGenXML 2.0 for a # better result! workflowTool._setOb('term_workflow', workflow) print >> out, '%s added in workflows.' % workflow.getId() workflowTool.setChainForPortalTypes(['DestinationTerm', 'MotivationTerm', 'DestinationTerm'], workflow.getId()) ##code-section after-workflow-install #fill in your manual code here ##/code-section after-workflow-install return out def uninstallWorkflows(self, package, out): """Deinstall the workflows. This code doesn't really do anything, but you can place custom code here in the protected section. """ workflowTool = getToolByName(self, 'portal_workflow') workflowTool.manage_delObjects(['workteleservices_workflow']) workflowTool.manage_delObjects(['populationteleservices_workflow']) workflowTool.manage_delObjects(['demandtypeterm_workflow']) workflowTool.manage_delObjects(['term_workflow']) ##code-section workflow-uninstall #fill in your manual code here ##/code-section workflow-uninstall pass