[1] | 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 | """ |
---|
| 7 | This 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 | |
---|
| 16 | from Products.Archetypes.public import listTypes |
---|
| 17 | from Products.Archetypes.Extensions.utils import installTypes, install_subskin |
---|
| 18 | from Products.CMFCore.utils import getToolByName |
---|
| 19 | from Products.ShortMessage.config import * |
---|
| 20 | from StringIO import StringIO |
---|
| 21 | |
---|
| 22 | from Products.ShortMessage.ShortMessage import ShortMessage |
---|
| 23 | from Products.ShortMessage.Extensions.Sm_Workflow import * |
---|
| 24 | |
---|
| 25 | def 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 | |
---|
| 37 | def 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 | |
---|
| 42 | def 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() |
---|