[Checkins] SVN: zope.app.wsgi/trunk/src/zope/app/wsgi/__init__.py Slight refactoring: move the code that loads zope.conf and the ZCML out to a

Philipp von Weitershausen philikon at philikon.de
Fri Sep 14 12:33:53 EDT 2007


Log message for revision 79639:
  Slight refactoring: move the code that loads zope.conf and the ZCML out to a
  'config' function that's just called by 'getApplication'. Makes it easier to 
  reuse that bit
  

Changed:
  U   zope.app.wsgi/trunk/src/zope/app/wsgi/__init__.py

-=-
Modified: zope.app.wsgi/trunk/src/zope/app/wsgi/__init__.py
===================================================================
--- zope.app.wsgi/trunk/src/zope/app/wsgi/__init__.py	2007-09-14 15:40:44 UTC (rev 79638)
+++ zope.app.wsgi/trunk/src/zope/app/wsgi/__init__.py	2007-09-14 16:33:53 UTC (rev 79639)
@@ -83,10 +83,7 @@
                 pass #zope.security.management.endInteraction()
 
 
-
-def getWSGIApplication(configfile, schemafile=None,
-                       features=(),
-                       requestFactory=HTTPPublicationRequestFactory):
+def config(configfile, schemafile=None, features=()):
     # Load the configuration schema
     if schemafile is None:
         schemafile = os.path.join(
@@ -123,14 +120,16 @@
             "and should NOT be enabled on production servers. Developer mode "
             "can be turned off in etc/zope.conf")
 
-    # Configure the application
+    # Execute the ZCML configuration.
     appsetup.config(options.site_definition, features=features)
 
-    # Connect to and open the database
+    # Connect to and open the database, notify subscribers.
     db = appsetup.multi_database(options.databases)[0][0]
-
-    # Send out an event that the database has been opened
     notify(appsetup.interfaces.DatabaseOpened(db))
 
-    # Create the WSGI application
+    return db
+
+def getWSGIApplication(configfile, schemafile=None, features=(),
+                       requestFactory=HTTPPublicationRequestFactory):
+    db = config(configfile, schemafile, features)
     return WSGIPublisherApplication(db, requestFactory)



More information about the Checkins mailing list