Skip to content

Instantly share code, notes, and snippets.

@miohtama
Created July 26, 2011 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miohtama/1106260 to your computer and use it in GitHub Desktop.
Save miohtama/1106260 to your computer and use it in GitHub Desktop.
How Zope starts up and where to fork
Zope start process
Zope2.__init__ contains ZopeStarter
def prepare(self):
self.setupInitialLogging()
self.setupLocale()
self.setupSecurityOptions()
self.setupPublisher()
# Start ZServer servers before we drop privileges so we can bind to
# "low" ports:
self.setupZServer()
self.setupServers()
# drop privileges after setting up servers
print "xxxxx"
self.dropPrivileges()
self.setupFinalLogging()
self.makeLockFile()
self.makePidFile()
self.setupInterpreter()
self.startZope()
self.serverListen()
from App.config import getConfiguration
config = getConfiguration()
self.registerSignals()
# emit a "ready" message in order to prevent the kinds of emails
# to the Zope maillist in which people claim that Zope has "frozen"
# after it has emitted ZServer messages.
logger.info('Ready to handle requests')
self.sendEvents()
ZopeStarter.startZope() -> Zope2.App.startup
Add-ons processed in Zope.App.startup.OFS.Application.initialize(application)
OFS.Application.AppInitializer.initialize()
def initialize(self):
app = self.getApp()
# make sure to preserve relative ordering of calls below.
self.install_cp_and_products()
self.install_tempfolder_and_sdc()
self.install_session_data_manager()
self.install_browser_id_manager()
self.install_required_roles()
self.install_inituser()
self.install_errorlog()
self.install_products()
self.install_standards()
self.install_virtual_hosting()
install_products()
Calls installing Products.Five.initialize()
Calling Products.Five.zcml.load_site()
Calling zope.configuration.xmlconfig.include() for every ZCML file.
* CMFPlone meta.zcml, configuration.zcml and overrides.zcml will call includePlugins for z3c.autoinclude
* z3c.autoinclude will hit your product
* First it will hit z3c.autoinclude ZCML and this will call __init__.initialize() for your add-on
(import __init__)
* Then it hits your add-on configuration.zcml in processxmlfile()
---> z3c.autoinclude must be the last egg loaded by Plone default stack
Bits needs to be moved:
CMFPlone meta.zcml
<include package="z3c.autoinclude" file="meta.zcml" />
<includePlugins
zcml:condition="not-have disable-autoinclude"
package="plone"
file="meta.zcml"
/>
configuration.zcml
<!-- include plone plugins with z3c.autoinclude -->
<includePlugins
zcml:condition="not-have disable-autoinclude"
package="plone"
file="configure.zcml"
/>
overrides.zcml
<includePluginsOverrides
zcml:condition="not-have disable-autoinclude"
package="plone"
file="overrides.zcml"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment