[Checkins]
SVN: grokproject/branches/use-zopeproject/grokproject/template/
Slightly adjust the GrokApp template to work on top the
zope_deploy template:
Philipp von Weitershausen
philikon at philikon.de
Sat Jul 14 14:16:00 EDT 2007
Log message for revision 77976:
Slightly adjust the GrokApp template to work on top the zope_deploy template:
* No longer need our own buildout.cfg
* We do need to define an application factory (currently sadly a copy from
the zope_app template).
Changed:
D grokproject/branches/use-zopeproject/grokproject/template/buildout.cfg_tmpl
U grokproject/branches/use-zopeproject/grokproject/template/setup.py_tmpl
A grokproject/branches/use-zopeproject/grokproject/template/src/+package+/application.py
-=-
Deleted: grokproject/branches/use-zopeproject/grokproject/template/buildout.cfg_tmpl
===================================================================
--- grokproject/branches/use-zopeproject/grokproject/template/buildout.cfg_tmpl 2007-07-14 18:10:19 UTC (rev 77975)
+++ grokproject/branches/use-zopeproject/grokproject/template/buildout.cfg_tmpl 2007-07-14 18:16:00 UTC (rev 77976)
@@ -1,59 +0,0 @@
-[buildout]
-develop = .
-parts = app data zopectl test
-find-links = http://download.zope.org/distribution/
-eggs-directory = ${eggs_dir}
-newest = ${newest}
-
-[data]
-recipe = zc.recipe.filestorage
-
-[app]
-recipe = zc.zope3recipes>=0.5.3:application
-eggs = ${egg}
-site.zcml = <include package="${package}" />
- <include package="zope.app.twisted" />
-
- <configure i18n_domain="${package}">
- <unauthenticatedPrincipal id="zope.anybody"
- title="Unauthenticated User" />
- <unauthenticatedGroup id="zope.Anybody"
- title="Unauthenticated Users" />
- <authenticatedGroup id="zope.Authenticated"
- title="Authenticated Users" />
- <everybodyGroup id="zope.Everybody"
- title="All Users" />
- <principal id="zope.manager"
- title="Manager"
- login="${user}"
- password_manager="Plain Text"
- password="${passwd}"
- />
-
- <!-- Replace the following directive if you don't want
- public access -->
- <grant permission="zope.View"
- principal="zope.Anybody" />
- <grant permission="zope.app.dublincore.view"
- principal="zope.Anybody" />
-
- <role id="zope.Manager" title="Site Manager" />
- <role id="zope.Member" title="Site Member" />
- <grantAll role="zope.Manager" />
- <grant role="zope.Manager"
- principal="zope.manager" />
- </configure>
-
-[data]
-recipe = zc.recipe.filestorage
-
-# this section named so that the start/stop script is called bin/zopectl
-[zopectl]
-recipe = zc.zope3recipes:instance
-application = app
-zope.conf = $${data:zconfig}
-
-[test]
-recipe = zc.recipe.testrunner
-eggs = ${egg}
-defaults = ['--tests-pattern', '^f?tests$$', '-v']
Modified: grokproject/branches/use-zopeproject/grokproject/template/setup.py_tmpl
===================================================================
--- grokproject/branches/use-zopeproject/grokproject/template/setup.py_tmpl 2007-07-14 18:10:19 UTC (rev 77975)
+++ grokproject/branches/use-zopeproject/grokproject/template/setup.py_tmpl 2007-07-14 18:16:00 UTC (rev 77976)
@@ -23,6 +23,7 @@
# Add extra requirements here
],
entry_points="""
- # Add entry points here
+ [paste.app_factory]
+ main = ${package}.application:application_factory
""",
)
Copied: grokproject/branches/use-zopeproject/grokproject/template/src/+package+/application.py (from rev 77975, Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/+package+/application.py)
===================================================================
--- grokproject/branches/use-zopeproject/grokproject/template/src/+package+/application.py (rev 0)
+++ grokproject/branches/use-zopeproject/grokproject/template/src/+package+/application.py 2007-07-14 18:16:00 UTC (rev 77976)
@@ -0,0 +1,32 @@
+import sys, os
+import ZConfig
+import zope.event
+import zope.app.appsetup
+from zope.app.wsgi import WSGIPublisherApplication
+from zope.app.appsetup.appsetup import multi_database
+from zope.app.appsetup.interfaces import DatabaseOpened, ProcessStarting
+
+def application_factory(global_conf, conf='zope.conf'):
+ # load 'zope.conf' configuration
+ schema_xml = os.path.join(
+ os.path.dirname(zope.app.appsetup.__file__), 'schema', 'schema.xml')
+ schema = ZConfig.loadSchema(schema_xml)
+ options, handlers = ZConfig.loadConfig(
+ schema, os.path.join(global_conf['here'], conf))
+
+ if options.path:
+ sys.path[0:0] = [os.path.abspath(p) for p in options.path]
+ options.eventlog()
+
+ # load ZCML configuration
+ features = ()
+ if options.devmode:
+ features += ('devmode',)
+ zope.app.appsetup.config(options.site_definition, features)
+
+ # notify of ZODB database opening
+ db = multi_database(options.databases)[0][0]
+ zope.event.notify(DatabaseOpened(db))
+
+ zope.event.notify(ProcessStarting())
+ return WSGIPublisherApplication(db)
More information about the Checkins
mailing list