[Checkins] SVN: zope.paste/trunk/zope/paste/factory.py Refactoring: extract database_factory() helper function.
Marius Gedminas
cvs-admin at zope.org
Mon Aug 20 15:02:21 UTC 2012
Log message for revision 127530:
Refactoring: extract database_factory() helper function.
This is convenient for people who want to customize the WSGI factory
function and would rather not copy and paste the existing one.
Changed:
U zope.paste/trunk/zope/paste/factory.py
-=-
Modified: zope.paste/trunk/zope/paste/factory.py
===================================================================
--- zope.paste/trunk/zope/paste/factory.py 2012-08-20 15:02:11 UTC (rev 127529)
+++ zope.paste/trunk/zope/paste/factory.py 2012-08-20 15:02:18 UTC (rev 127530)
@@ -35,11 +35,18 @@
filename = os.path.join(global_conf['here'], site_definition)
zope.app.appsetup.config(filename, features)
+ # open database
+ db = database_factory(global_conf, file_storage, db_definition)
+
+ _zope_app = WSGIPublisherApplication(db)
+ return _zope_app
+
+
+def database_factory(global_conf, file_storage=None, db_definition=None):
if file_storage is not None and db_definition is not None:
raise TypeError("You may only provide a 'file_storage' or a "
"'db_definition' setting, not both.")
- # open database
if file_storage is not None:
filename = os.path.join(global_conf['here'], file_storage)
db = zope.app.appsetup.database(filename)
@@ -55,5 +62,5 @@
else:
db = None
- _zope_app = WSGIPublisherApplication(db)
- return _zope_app
+ return db
+
More information about the checkins
mailing list