[Checkins] SVN: Sandbox/ulif/grokcore.startup/src/grokcore/startup/README.txt Add first tests.
Uli Fouquet
uli at gnufix.de
Sun Feb 1 11:40:08 EST 2009
Log message for revision 95879:
Add first tests.
Changed:
A Sandbox/ulif/grokcore.startup/src/grokcore/startup/README.txt
-=-
Added: Sandbox/ulif/grokcore.startup/src/grokcore/startup/README.txt
===================================================================
--- Sandbox/ulif/grokcore.startup/src/grokcore/startup/README.txt (rev 0)
+++ Sandbox/ulif/grokcore.startup/src/grokcore/startup/README.txt 2009-02-01 16:40:08 UTC (rev 95879)
@@ -0,0 +1,53 @@
+grokcore.startup
+****************
+
+Single functions
+================
+
+application_factory(global_conf, **local_conf)
+----------------------------------------------
+
+`grokcore.startup` provides a function `application_factory` which
+delivers a `WSGIPublisherApplication` instance when called with an
+appropriate configuration.
+
+A call to this function is normally required as entry point in
+`setuptools`-driven paster environments.
+
+We have to create our own site definition file -- which will simply be
+empty -- to provide a minimal test::
+
+ >>> import os, tempfile
+ >>> temp_dir = tempfile.mkdtemp()
+ >>> sitezcml = os.path.join(temp_dir, 'site.zcml')
+ >>> open(sitezcml, 'w').write('<configure />')
+
+Furthermore we create a Zope configuration file, which is also quite
+plain::
+
+ >>> zope_conf = os.path.join(temp_dir, 'zope.conf')
+ >>> open(zope_conf, 'wb').write('''
+ ... site-definition %s
+ ...
+ ... <zodb>
+ ... <mappingstorage />
+ ... </zodb>
+ ...
+ ... <eventlog>
+ ... <logfile>
+ ... path STDOUT
+ ... </logfile>
+ ... </eventlog>
+ ... ''' %sitezcml)
+
+Now we can call `application_factory` to get a WSGI application::
+
+ >>> from grokcore.startup.startup import application_factory
+ >>> app_factory = application_factory(dict(zope_conf = zope_conf))
+ >>> app_factory
+ <zope.app.wsgi.WSGIPublisherApplication object at 0x...>
+
+Clean up::
+
+ >>> import shutil
+ >>> shutil.rmtree(temp_dir)
More information about the Checkins
mailing list