2009-06-29 07:06:01 -05:00
|
|
|
'''This package contains stuff used at run-time for installing a generated
|
2011-12-01 13:53:13 -06:00
|
|
|
Zope product.'''
|
2009-06-29 07:06:01 -05:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2013-09-09 16:14:50 -05:00
|
|
|
import os, os.path
|
2009-10-18 07:52:27 -05:00
|
|
|
import appy
|
2011-09-26 14:19:34 -05:00
|
|
|
import appy.version
|
2011-12-05 08:11:29 -06:00
|
|
|
import appy.gen as gen
|
2011-01-14 02:06:25 -06:00
|
|
|
from appy.gen.po import PoParser
|
2012-09-26 16:13:02 -05:00
|
|
|
from appy.gen.indexer import defaultIndexes, updateIndexes
|
2012-02-02 10:30:54 -06:00
|
|
|
from appy.gen.migrator import Migrator
|
2013-08-21 05:35:30 -05:00
|
|
|
from appy.gen import utils as gutils
|
2011-01-14 02:06:25 -06:00
|
|
|
from appy.shared.data import languages
|
2010-08-05 11:23:17 -05:00
|
|
|
|
2011-11-25 11:01:20 -06:00
|
|
|
# ------------------------------------------------------------------------------
|
2013-08-21 05:35:30 -05:00
|
|
|
homePage = '<tal:h define="dummy python: request.RESPONSE.redirect(' \
|
|
|
|
'context.config.getHomePage())"/>'
|
2009-06-29 07:06:01 -05:00
|
|
|
|
2013-10-18 09:42:52 -05:00
|
|
|
# Cheat for disabling Zope's XMLRPC --------------------------------------------
|
|
|
|
class FakeXmlrpc:
|
|
|
|
'''Fake class that behaves like Zope's xmlrpc module.'''
|
|
|
|
def parse_input(self, value): return None, ()
|
|
|
|
def response(self, response): return response
|
|
|
|
|
2011-06-10 10:20:09 -05:00
|
|
|
def onDelSession(sessionObject, container):
|
|
|
|
'''This function is called when a session expires.'''
|
|
|
|
rq = container.REQUEST
|
2013-08-21 05:35:30 -05:00
|
|
|
if rq.cookies.has_key('_appy_') and rq.cookies.has_key('_ZopeId') and \
|
2011-06-10 10:20:09 -05:00
|
|
|
(rq['_ZopeId'] == sessionObject.token):
|
|
|
|
# The request comes from a guy whose session has expired.
|
|
|
|
resp = rq.RESPONSE
|
2013-08-21 05:35:30 -05:00
|
|
|
resp.expireCookie('_appy_', path='/')
|
2012-04-25 09:21:23 -05:00
|
|
|
resp.setHeader('Content-Type', 'text/html')
|
2011-06-10 10:20:09 -05:00
|
|
|
resp.write('<center>For security reasons, your session has ' \
|
|
|
|
'expired.</center>')
|
|
|
|
|
2009-06-29 07:06:01 -05:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
class ZopeInstaller:
|
|
|
|
'''This Zope installer runs every time Zope starts and encounters this
|
|
|
|
generated Zope product.'''
|
2013-08-21 05:35:30 -05:00
|
|
|
# Info about the default users that are always present.
|
|
|
|
defaultUsers = {'admin': ('Manager',), 'system': ('Manager',), 'anon': ()}
|
|
|
|
|
2011-11-25 11:01:20 -06:00
|
|
|
def __init__(self, zopeContext, config, classes):
|
2009-06-29 07:06:01 -05:00
|
|
|
self.zopeContext = zopeContext
|
2011-11-25 11:01:20 -06:00
|
|
|
self.app = zopeContext._ProductContext__app # The root of the Zope tree
|
|
|
|
self.config = config
|
2010-08-05 11:23:17 -05:00
|
|
|
self.classes = classes
|
2010-09-02 09:16:08 -05:00
|
|
|
# Unwrap some useful config variables
|
2011-11-25 11:01:20 -06:00
|
|
|
self.productName = config.PROJECTNAME
|
2013-07-24 08:53:19 -05:00
|
|
|
self.languages = config.appConfig.languages
|
2011-11-25 11:01:20 -06:00
|
|
|
self.logger = config.logger
|
|
|
|
|
|
|
|
def installUi(self):
|
|
|
|
'''Installs the user interface.'''
|
2013-08-21 15:25:27 -05:00
|
|
|
# Some useful imports.
|
2012-02-02 10:30:54 -06:00
|
|
|
from OFS.Folder import manage_addFolder
|
|
|
|
from OFS.Image import manage_addImage, manage_addFile
|
|
|
|
# Delete the existing folder if it existed.
|
|
|
|
zopeContent = self.app.objectIds()
|
|
|
|
if 'ui' in zopeContent: self.app.manage_delObjects(['ui'])
|
|
|
|
manage_addFolder(self.app, 'ui')
|
2012-02-18 12:48:00 -06:00
|
|
|
# Browse the physical ui folders (the Appy one and an app-specific, if
|
|
|
|
# the app defines one) and create the corresponding objects in the Zope
|
|
|
|
# folder. In the case of files having the same name in both folders,
|
|
|
|
# the one from the app-specific folder is chosen.
|
2011-11-25 11:01:20 -06:00
|
|
|
j = os.path.join
|
2012-02-18 12:48:00 -06:00
|
|
|
uiFolders = [j(j(appy.getPath(), 'gen'), 'ui')]
|
2014-03-28 06:25:42 -05:00
|
|
|
for uiFolder in self.config.appConfig.uiFolders:
|
|
|
|
if uiFolder.startswith('..'):
|
|
|
|
folder = j(os.path.dirname(self.config.diskFolder),uiFolder[3:])
|
|
|
|
else:
|
|
|
|
folder = j(self.config.diskFolder, uiFolder)
|
|
|
|
if os.path.exists(folder):
|
|
|
|
uiFolders.insert(0, folder)
|
2012-02-18 12:48:00 -06:00
|
|
|
for ui in uiFolders:
|
|
|
|
for root, dirs, files in os.walk(ui):
|
|
|
|
folderName = root[len(ui):]
|
|
|
|
# Get the Zope folder that corresponds to this name
|
|
|
|
zopeFolder = self.app.ui
|
|
|
|
if folderName:
|
|
|
|
for name in folderName.strip(os.sep).split(os.sep):
|
|
|
|
zopeFolder = zopeFolder._getOb(name)
|
|
|
|
# Create sub-folders at this level
|
|
|
|
for name in dirs:
|
|
|
|
if not hasattr(zopeFolder.aq_base, name):
|
|
|
|
manage_addFolder(zopeFolder, name)
|
|
|
|
# Create files at this level
|
|
|
|
for name in files:
|
2013-08-21 15:25:27 -05:00
|
|
|
ext = os.path.splitext(name)[1]
|
|
|
|
if hasattr(zopeFolder.aq_base, name): continue
|
2012-02-18 12:48:00 -06:00
|
|
|
f = file(j(root, name))
|
2013-08-21 15:25:27 -05:00
|
|
|
if name == 'favicon.ico':
|
|
|
|
if not hasattr(self.app, name):
|
2012-09-20 02:37:33 -05:00
|
|
|
# Copy it at the root. Else, IE won't notice it.
|
2013-08-21 15:25:27 -05:00
|
|
|
manage_addImage(self.app, name, f)
|
2012-09-20 02:37:33 -05:00
|
|
|
elif ext in gen.File.imageExts:
|
2013-08-21 15:25:27 -05:00
|
|
|
manage_addImage(zopeFolder, name, f)
|
2012-02-18 12:48:00 -06:00
|
|
|
else:
|
2013-08-21 15:25:27 -05:00
|
|
|
manage_addFile(zopeFolder, name, f)
|
2012-02-18 12:48:00 -06:00
|
|
|
f.close()
|
2011-11-25 11:01:20 -06:00
|
|
|
# Update the home page
|
|
|
|
if 'index_html' in zopeContent:
|
|
|
|
self.app.manage_delObjects(['index_html'])
|
2013-08-21 15:25:27 -05:00
|
|
|
from Products.PageTemplates.ZopePageTemplate import \
|
|
|
|
manage_addPageTemplate
|
2011-11-25 11:01:20 -06:00
|
|
|
manage_addPageTemplate(self.app, 'index_html', '', homePage)
|
2013-08-21 15:25:27 -05:00
|
|
|
# Remove the error page.
|
2011-11-25 11:01:20 -06:00
|
|
|
if 'standard_error_message' in zopeContent:
|
|
|
|
self.app.manage_delObjects(['standard_error_message'])
|
|
|
|
|
|
|
|
def installCatalog(self):
|
|
|
|
'''Create the catalog at the root of Zope if id does not exist.'''
|
|
|
|
if 'catalog' not in self.app.objectIds():
|
|
|
|
# Create the catalog
|
|
|
|
from Products.ZCatalog.ZCatalog import manage_addZCatalog
|
|
|
|
manage_addZCatalog(self.app, 'catalog', '')
|
|
|
|
self.logger.info('Appy catalog created.')
|
2011-12-01 13:53:13 -06:00
|
|
|
|
2012-09-26 16:13:02 -05:00
|
|
|
# Create lexicons for ZCTextIndexes
|
|
|
|
catalog = self.app.catalog
|
|
|
|
lexicons = catalog.objectIds()
|
|
|
|
from Products.ZCTextIndex.ZCTextIndex import manage_addLexicon
|
|
|
|
if 'xhtml_lexicon' not in lexicons:
|
|
|
|
lex = appy.Object(group='XHTML indexer', name='XHTML indexer')
|
|
|
|
manage_addLexicon(catalog, 'xhtml_lexicon', elements=[lex])
|
|
|
|
if 'text_lexicon' not in lexicons:
|
|
|
|
lex = appy.Object(group='Text indexer', name='Text indexer')
|
|
|
|
manage_addLexicon(catalog, 'text_lexicon', elements=[lex])
|
|
|
|
if 'list_lexicon' not in lexicons:
|
|
|
|
lex = appy.Object(group='List indexer', name='List indexer')
|
|
|
|
manage_addLexicon(catalog, 'list_lexicon', elements=[lex])
|
|
|
|
|
|
|
|
# Delete the deprecated one if it exists
|
|
|
|
if 'lexicon' in lexicons: catalog.manage_delObjects(['lexicon'])
|
2011-12-01 13:53:13 -06:00
|
|
|
|
2011-11-25 11:01:20 -06:00
|
|
|
# Create or update Appy-wide indexes and field-related indexes
|
2012-09-26 16:13:02 -05:00
|
|
|
indexInfo = defaultIndexes.copy()
|
2011-11-25 11:01:20 -06:00
|
|
|
tool = self.app.config
|
|
|
|
for className in self.config.attributes.iterkeys():
|
|
|
|
wrapperClass = tool.getAppyClass(className, wrapper=True)
|
2012-09-04 11:00:22 -05:00
|
|
|
indexInfo.update(wrapperClass.getIndexes(includeDefaults=False))
|
2012-09-26 16:13:02 -05:00
|
|
|
updateIndexes(self, indexInfo)
|
2013-02-18 08:03:26 -06:00
|
|
|
# Re-index index "SearchableText", wrongly defined for Appy < 0.8.3.
|
|
|
|
stIndex = catalog.Indexes['SearchableText']
|
|
|
|
if stIndex.indexSize() == 0:
|
|
|
|
self.logger.info('Reindexing SearchableText...')
|
|
|
|
catalog.reindexIndex('SearchableText', self.app.REQUEST)
|
|
|
|
self.logger.info('Done.')
|
2011-11-25 11:01:20 -06:00
|
|
|
|
|
|
|
def installBaseObjects(self):
|
2013-08-23 11:57:27 -05:00
|
|
|
'''Creates the tool and the base data folder if they do not exist.'''
|
|
|
|
# Create the tool.
|
2011-11-25 11:01:20 -06:00
|
|
|
zopeContent = self.app.objectIds()
|
2012-02-02 10:30:54 -06:00
|
|
|
from OFS.Folder import manage_addFolder
|
2011-11-28 15:50:01 -06:00
|
|
|
|
2012-06-02 07:36:49 -05:00
|
|
|
if 'config' not in zopeContent:
|
|
|
|
toolName = '%sTool' % self.productName
|
2013-08-21 05:35:30 -05:00
|
|
|
gutils.createObject(self.app, 'config', toolName, self.productName,
|
|
|
|
wf=False, noSecurity=True)
|
2013-08-23 11:57:27 -05:00
|
|
|
# Create the base data folder.
|
|
|
|
if 'data' not in zopeContent: manage_addFolder(self.app, 'data')
|
2011-11-28 15:50:01 -06:00
|
|
|
|
|
|
|
# Remove some default objects created by Zope but not useful to Appy
|
2011-11-25 11:01:20 -06:00
|
|
|
for name in ('standard_html_footer', 'standard_html_header',\
|
|
|
|
'standard_template.pt'):
|
|
|
|
if name in zopeContent: self.app.manage_delObjects([name])
|
|
|
|
|
|
|
|
def installTool(self):
|
|
|
|
'''Updates the tool (now that the catalog is created) and updates its
|
2011-11-28 15:50:01 -06:00
|
|
|
inner objects (users, groups, translations, documents).'''
|
2011-11-25 11:01:20 -06:00
|
|
|
tool = self.app.config
|
|
|
|
tool.createOrUpdate(True, None)
|
|
|
|
appyTool = tool.appy()
|
2011-12-01 13:53:13 -06:00
|
|
|
appyTool.log('Appy version is "%s".' % appy.version.short)
|
2011-11-25 11:01:20 -06:00
|
|
|
|
2014-02-26 03:40:27 -06:00
|
|
|
# Execute custom pre-installation code if any.
|
|
|
|
if hasattr(appyTool, 'beforeInstall'): appyTool.beforeInstall()
|
|
|
|
|
2013-08-21 05:35:30 -05:00
|
|
|
# Create the default users if they do not exist.
|
|
|
|
for login, roles in self.defaultUsers.iteritems():
|
|
|
|
if not appyTool.count('User', noSecurity=True, login=login):
|
2013-08-23 11:57:27 -05:00
|
|
|
appyTool.create('users', noSecurity=True, id=login, login=login,
|
2013-08-21 05:35:30 -05:00
|
|
|
password1=login, password2=login,
|
|
|
|
email='%s@appyframework.org'%login, roles=roles)
|
|
|
|
appyTool.log('User "%s" created.' % login)
|
2011-11-28 15:50:01 -06:00
|
|
|
|
|
|
|
# Create group "admins" if it does not exist
|
2012-05-05 10:04:19 -05:00
|
|
|
if not appyTool.count('Group', noSecurity=True, login='admins'):
|
2012-06-02 07:36:49 -05:00
|
|
|
appyTool.create('groups', noSecurity=True, login='admins',
|
|
|
|
title='Administrators', roles=['Manager'])
|
2011-11-28 15:50:01 -06:00
|
|
|
appyTool.log('Group "admins" created.')
|
|
|
|
|
|
|
|
# Create a group for every global role defined in the application
|
2013-07-23 10:07:27 -05:00
|
|
|
# (if required).
|
2013-07-24 08:53:19 -05:00
|
|
|
if self.config.appConfig.groupsForGlobalRoles:
|
2013-07-23 10:07:27 -05:00
|
|
|
for role in self.config.applicationGlobalRoles:
|
|
|
|
groupId = role.lower()
|
|
|
|
if appyTool.count('Group', noSecurity=True, login=groupId):
|
|
|
|
continue
|
|
|
|
appyTool.create('groups', noSecurity=True, login=groupId,
|
|
|
|
title=role, roles=[role])
|
|
|
|
appyTool.log('Group "%s", related to global role "%s", was ' \
|
|
|
|
'created.' % (groupId, role))
|
2011-11-28 15:50:01 -06:00
|
|
|
|
2011-11-25 11:01:20 -06:00
|
|
|
# Create or update Translation objects
|
|
|
|
translations = [t.o.id for t in appyTool.translations]
|
|
|
|
# We browse the languages supported by this application and check
|
|
|
|
# whether we need to create the corresponding Translation objects.
|
2014-08-08 05:36:19 -05:00
|
|
|
done = []
|
2011-11-25 11:01:20 -06:00
|
|
|
for language in self.languages:
|
|
|
|
if language in translations: continue
|
|
|
|
# We will create, in the tool, the translation object for this
|
|
|
|
# language. Determine first its title.
|
|
|
|
langId, langEn, langNat = languages.get(language)
|
|
|
|
if langEn != langNat:
|
|
|
|
title = '%s (%s)' % (langEn, langNat)
|
|
|
|
else:
|
|
|
|
title = langEn
|
2012-06-02 07:36:49 -05:00
|
|
|
appyTool.create('translations', noSecurity=True,
|
|
|
|
id=language, title=title)
|
2014-08-08 05:36:19 -05:00
|
|
|
done.append(language)
|
|
|
|
if done: appyTool.log('Translations created for %s.' % ', '.join(done))
|
2011-11-25 11:01:20 -06:00
|
|
|
|
2014-03-05 09:19:11 -06:00
|
|
|
# Synchronizes, if required, every Translation object with the
|
|
|
|
# corresponding "po" file on disk.
|
2012-06-03 14:55:26 -05:00
|
|
|
if appyTool.loadTranslationsAtStartup:
|
|
|
|
appFolder = self.config.diskFolder
|
|
|
|
appName = self.config.PROJECTNAME
|
|
|
|
i18nFolder = os.path.join(appFolder, 'tr')
|
2014-08-08 05:36:19 -05:00
|
|
|
done = []
|
2012-06-03 14:55:26 -05:00
|
|
|
for translation in appyTool.translations:
|
|
|
|
# Get the "po" file
|
|
|
|
poName = '%s-%s.po' % (appName, translation.id)
|
|
|
|
poFile = PoParser(os.path.join(i18nFolder, poName)).parse()
|
|
|
|
for message in poFile.messages:
|
|
|
|
setattr(translation, message.id, message.getMessage())
|
2014-08-08 05:36:19 -05:00
|
|
|
done.append(translation.id)
|
|
|
|
appyTool.log('Translation(s) %s updated (%s messages).' % \
|
|
|
|
(', '.join(done), len(poFile.messages)))
|
2012-06-03 14:55:26 -05:00
|
|
|
|
2013-07-23 10:07:27 -05:00
|
|
|
# Execute custom installation code if any.
|
|
|
|
if hasattr(appyTool, 'onInstall'): appyTool.onInstall()
|
|
|
|
|
2011-11-25 11:01:20 -06:00
|
|
|
def configureSessions(self):
|
|
|
|
'''Configure the session machinery.'''
|
|
|
|
# Register a function warning us when a session object is deleted. When
|
2012-11-26 06:58:27 -06:00
|
|
|
# launching Zope in test mode, the temp folder does not exist.
|
2011-11-25 11:01:20 -06:00
|
|
|
if not hasattr(self.app, 'temp_folder'): return
|
2012-12-15 16:36:56 -06:00
|
|
|
sessionData = self.app.temp_folder.session_data
|
2013-07-24 08:53:19 -05:00
|
|
|
if self.config.appConfig.enableSessionTimeout:
|
2012-12-15 16:36:56 -06:00
|
|
|
sessionData.setDelNotificationTarget(onDelSession)
|
|
|
|
else:
|
|
|
|
sessionData.setDelNotificationTarget(None)
|
2011-11-25 11:01:20 -06:00
|
|
|
|
|
|
|
def installZopeClasses(self):
|
|
|
|
'''Zope-level class registration.'''
|
|
|
|
for klass in self.classes:
|
|
|
|
name = klass.__name__
|
|
|
|
module = klass.__module__
|
|
|
|
wrapper = klass.wrapperClass
|
|
|
|
exec 'from %s import manage_add%s as ctor' % (module, name)
|
|
|
|
self.zopeContext.registerClass(meta_type=name,
|
2013-08-23 11:57:27 -05:00
|
|
|
constructors = (ctor,), permission = None)
|
2011-11-25 11:01:20 -06:00
|
|
|
# Create workflow prototypical instances in __instance__ attributes
|
2012-06-01 08:57:19 -05:00
|
|
|
wf = wrapper.getWorkflow()
|
|
|
|
if not hasattr(wf, '__instance__'): wf.__instance__ = wf()
|
2011-11-25 11:01:20 -06:00
|
|
|
|
|
|
|
def installAppyTypes(self):
|
2010-08-05 11:23:17 -05:00
|
|
|
'''We complete here the initialisation process of every Appy type of
|
|
|
|
every gen-class of the application.'''
|
2011-09-14 14:01:58 -05:00
|
|
|
appName = self.productName
|
2010-08-05 11:23:17 -05:00
|
|
|
for klass in self.classes:
|
2011-09-14 14:01:58 -05:00
|
|
|
# Store on wrapper class the ordered list of Appy types
|
|
|
|
wrapperClass = klass.wrapperClass
|
|
|
|
if not hasattr(wrapperClass, 'title'):
|
|
|
|
# Special field "type" is mandatory for every class.
|
2013-02-18 08:03:26 -06:00
|
|
|
title = gen.String(multiplicity=(1,1), show='edit',
|
|
|
|
indexed=True, searchable=True)
|
2011-09-14 14:01:58 -05:00
|
|
|
title.init('title', None, 'appy')
|
|
|
|
setattr(wrapperClass, 'title', title)
|
2013-09-24 05:26:31 -05:00
|
|
|
# Special field "state" must be added for every class. It must be a
|
|
|
|
# "select" field, because it will be necessary for displaying the
|
|
|
|
# translated state name.
|
|
|
|
state = gen.String(validator=gen.Selection('listStates'),
|
|
|
|
show='result')
|
[gen] Added param Search.default allowing to define a default Search. The default search, if present, will be triggered when clicking on the main link for a class, instead of the query that collects all instances of this class; appy.gen.Type: removed 3 obsolete params: 'index', 'editDefault' and 'optional'. For achieving the same result than using 'editDefault', one may define 'by hand' an attribute on the Tool for storing the editable default value, and define, on the appropriate field in param 'default', a method that returns the value of the tool attribute; Added Type.defaultForSearch, allowing, for some sub-types, to define a default value when displaying the corresponding widget on the search screen; added a default 'state' field allowing to include workflow state among search criteria in the search screens; removed obsolete test applications.
2012-10-31 07:20:25 -05:00
|
|
|
state.init('state', None, 'workflow')
|
|
|
|
setattr(wrapperClass, 'state', state)
|
2011-09-14 14:01:58 -05:00
|
|
|
names = self.config.attributes[wrapperClass.__name__[:-8]]
|
|
|
|
wrapperClass.__fields__ = [getattr(wrapperClass, n) for n in names]
|
|
|
|
# Post-initialise every Appy type
|
2010-08-05 11:23:17 -05:00
|
|
|
for baseClass in klass.wrapperClass.__bases__:
|
2011-09-14 14:01:58 -05:00
|
|
|
if baseClass.__name__ == 'AbstractWrapper': continue
|
2010-08-05 11:23:17 -05:00
|
|
|
for name, appyType in baseClass.__dict__.iteritems():
|
2013-07-08 16:39:16 -05:00
|
|
|
if not isinstance(appyType, gen.Field) or \
|
2011-12-05 08:11:29 -06:00
|
|
|
(isinstance(appyType, gen.Ref) and appyType.isBack):
|
2011-09-14 14:01:58 -05:00
|
|
|
continue # Back refs are initialised within fw refs
|
|
|
|
appyType.init(name, baseClass, appName)
|
2009-06-29 07:06:01 -05:00
|
|
|
|
2011-11-28 15:50:01 -06:00
|
|
|
def installRoles(self):
|
|
|
|
'''Installs the application-specific roles if not already done.'''
|
|
|
|
roles = list(self.app.__ac_roles__)
|
|
|
|
for role in self.config.applicationRoles:
|
|
|
|
if role not in roles: roles.append(role)
|
|
|
|
self.app.__ac_roles__ = tuple(roles)
|
|
|
|
|
2013-10-08 15:41:21 -05:00
|
|
|
def patchZope(self):
|
|
|
|
'''Patches some arts of Zope.'''
|
|
|
|
# Disables XMLRPC. This way, Zope can transmit HTTP POSTs containing
|
|
|
|
# XML to Appy without trying to recognize it himself as XMLRPC requests.
|
|
|
|
import ZPublisher.HTTPRequest
|
|
|
|
ZPublisher.HTTPRequest.xmlrpc = FakeXmlrpc()
|
|
|
|
|
2011-12-01 13:53:13 -06:00
|
|
|
def installDependencies(self):
|
|
|
|
'''Zope products are installed in alphabetical order. But here, we need
|
|
|
|
ZCTextIndex to be installed before our Appy application. So, we cheat
|
|
|
|
and force Zope to install it now.'''
|
|
|
|
from OFS.Application import install_product
|
|
|
|
import Products
|
|
|
|
install_product(self.app, Products.__path__[1], 'ZCTextIndex', [], {})
|
2012-02-02 10:30:54 -06:00
|
|
|
|
2009-06-29 07:06:01 -05:00
|
|
|
def install(self):
|
2011-12-01 13:53:13 -06:00
|
|
|
self.installDependencies()
|
2013-10-08 15:41:21 -05:00
|
|
|
self.patchZope()
|
2011-11-28 15:50:01 -06:00
|
|
|
self.installRoles()
|
2011-11-25 11:01:20 -06:00
|
|
|
self.installAppyTypes()
|
|
|
|
self.installZopeClasses()
|
|
|
|
self.configureSessions()
|
|
|
|
self.installBaseObjects()
|
2012-03-19 11:00:44 -05:00
|
|
|
# The following line cleans and rebuilds the catalog entirely.
|
|
|
|
#self.app.config.appy().refreshCatalog()
|
2013-05-17 08:00:31 -05:00
|
|
|
self.installCatalog()
|
2011-11-25 11:01:20 -06:00
|
|
|
self.installTool()
|
|
|
|
self.installUi()
|
2012-02-02 10:30:54 -06:00
|
|
|
# Perform migrations if required
|
|
|
|
Migrator(self).run()
|
|
|
|
# Update Appy version in the database
|
|
|
|
self.app.config.appy().appyVersion = appy.version.short
|
2011-12-05 11:15:45 -06:00
|
|
|
# Empty the fake REQUEST object, only used at Zope startup.
|
|
|
|
del self.app.config.getProductConfig().fakeRequest.wrappers
|
2009-06-29 07:06:01 -05:00
|
|
|
# ------------------------------------------------------------------------------
|