source: products/ShortMessage/trunk/Extensions/Install.py @ 1591

Last change on this file since 1591 was 1, checked in by myroslav, 18 years ago

Building directory structure

File size: 1.9 KB
Line 
1# Author: Melnychuk Taras
2# Contact: fenix@quintagroup.com
3# Date: $Date: 2005-11-23 13:10:10 +0200 (Thu, 23 Nov 2005) $
4# Copyright: quintagroup.com
5
6"""
7This module is created for installing ShortMessage product to Plone site.
8 It has such functions:
9
10     - `install`: this function sets all types in ShortMessage product, also install skin directory and other
11     - `install_workflow`: this function create new workflow and sets it to ShortMessage type
12     - `setPortalFactoryType`: sets ShortMessage type to PortalFactory
13"""
14__docformat__ = 'restructuredtext'
15
16from Products.Archetypes.public import listTypes
17from Products.Archetypes.Extensions.utils import installTypes, install_subskin
18from Products.CMFCore.utils import getToolByName
19from Products.ShortMessage.config import *
20from StringIO import StringIO
21
22from Products.ShortMessage.ShortMessage import ShortMessage
23from Products.ShortMessage.Extensions.Sm_Workflow import *
24
25def setPortalFactoryType(self, out,):
26    """sets ShortMessage type to PortalFactory"""
27    pf=getToolByName(self, 'portal_factory')
28    ftypes=list(pf.getFactoryTypes())
29    if 'ShortMessage'not in ftypes:
30        ftypes.append('ShortMessage')
31        pf.manage_setPortalFactoryTypes(listOfTypeIds=ftypes)
32    else:
33        print >>out, " %s type already  in portal_factory..." %PROJECTNAME
34
35    print >> out, "Set %s type to portal_factory" %PROJECTNAME
36
37def install_workflow(self, out):
38    """this function create new workflow and sets it to ShortMessage type"""
39    setupWorkflow(self)
40    print >> out, "Installed workflow..."
41
42def install(self):
43    """this function sets all types in ShortMessage product, also install skin directory and other"""
44    out=StringIO();
45
46    installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME)
47    setPortalFactoryType(self, out)
48    install_workflow(self, out)
49
50#    install_subskin(self, out, GLOBALS)
51
52    print >> out, "Successfully installed %s." % PROJECTNAME
53    return out.getvalue()
Note: See TracBrowser for help on using the repository browser.