[Zope3-checkins] SVN: Zope3/trunk/ Modifications to the WSGI Application after

Eckart Hertzler eckart at hertzler.de
Fri Nov 12 04:54:09 EST 2004


Log message for revision 28443:
  
  
    Modifications to the WSGI Application after 
    discussion with Phillip J. Ebly:
  
    - Have zope.app.server.main.setup return the database instance
      so we can start up zope an use the instance to configure the
      WSGI application object separatly from the normal Zope3 startup
  
    - remove event subscriber and associated ZCML to obtain
      a database instance in favour of explicitly setting the database
      instance
  
    - added a short README explaining how to use the WSGI application
      object.
  
  
  

Changed:
  D   Zope3/trunk/package-includes/wsgi-configure.zcml
  U   Zope3/trunk/src/zope/app/server/main.py
  A   Zope3/trunk/src/zope/app/wsgi/README.txt
  U   Zope3/trunk/src/zope/app/wsgi/__init__.py
  D   Zope3/trunk/src/zope/app/wsgi/configure.zcml

-=-
Deleted: Zope3/trunk/package-includes/wsgi-configure.zcml
===================================================================
--- Zope3/trunk/package-includes/wsgi-configure.zcml	2004-11-11 21:00:44 UTC (rev 28442)
+++ Zope3/trunk/package-includes/wsgi-configure.zcml	2004-11-12 09:54:09 UTC (rev 28443)
@@ -1 +0,0 @@
-<include package="zope.app.wsgi" />

Modified: Zope3/trunk/src/zope/app/server/main.py
===================================================================
--- Zope3/trunk/src/zope/app/server/main.py	2004-11-11 21:00:44 UTC (rev 28442)
+++ Zope3/trunk/src/zope/app/server/main.py	2004-11-12 09:54:09 UTC (rev 28443)
@@ -110,3 +110,5 @@
         server.create(task_dispatcher, db)
 
     notify(zope.app.appsetup.ProcessStarting())
+
+    return db

Added: Zope3/trunk/src/zope/app/wsgi/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/wsgi/README.txt	2004-11-11 21:00:44 UTC (rev 28442)
+++ Zope3/trunk/src/zope/app/wsgi/README.txt	2004-11-12 09:54:09 UTC (rev 28443)
@@ -0,0 +1,43 @@
+=====================
+Zope WSGI Application
+=====================
+
+About
+-----
+This package contains a WSGI application for Zope.
+
+WSGI is the Python Web Server Gateway Interface, an
+upcoming PEP to standardize the interface between web servers
+and python applications to promote portability.
+
+For more information, refer to the WSGI specification: http://www.python.org/peps/pep-0333.html
+
+Usage
+-----
+To use Zope as a WSGI application, the following steps must be taken
+
+* configure and setup Zope
+
+* create an instance of ``zope.app.wsgi.PublisherApp`` must be created
+  with a refernce to an open database
+
+* This instance must be set as the WSGI servers application object
+
+
+Example::
+
+    from zope.app.server.main import setup, load_options
+    from zope.app.wsgi import PublisherApp
+
+    args = ["-C/path/to/zope.conf"]
+    db = setup(load_options(args))
+
+    my_app = PublisherApp(db)
+
+    wsgi_server.set_app(my_app)
+
+This assumes, that Zope is available on the ``PYTHONPATH``.
+Note that you may have to edit ``zope.conf`` to provide
+an absolute path for ``site.zcml``.
+
+


Property changes on: Zope3/trunk/src/zope/app/wsgi/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: Zope3/trunk/src/zope/app/wsgi/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/wsgi/__init__.py	2004-11-11 21:00:44 UTC (rev 28442)
+++ Zope3/trunk/src/zope/app/wsgi/__init__.py	2004-11-12 09:54:09 UTC (rev 28443)
@@ -130,16 +130,3 @@
         # since the response is written using the WSGI write callable
         # return an empty iterable (see 
         return ""
-
-
-# provides an WSGI application object
-publisherApp = PublisherApp()
-
-def bootStrapSubscriber(event):
-    """subcriber for a database opened event
-    initializes the request factory of the wsgi applicaion object
-    """
-    publisherApp.request_factory = \
-        HTTPPublicationRequestFactory(event.database)
-
-

Deleted: Zope3/trunk/src/zope/app/wsgi/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/wsgi/configure.zcml	2004-11-11 21:00:44 UTC (rev 28442)
+++ Zope3/trunk/src/zope/app/wsgi/configure.zcml	2004-11-12 09:54:09 UTC (rev 28443)
@@ -1,8 +0,0 @@
-<configure xmlns="http://namespaces.zope.org/zope">
-
-  <subscriber
-      for="zope.app.appsetup.IDatabaseOpenedEvent"
-      factory=".bootStrapSubscriber"
-      />
-
-</configure>



More information about the Zope3-Checkins mailing list