[Zope-Checkins] CVS: Zope3 - z3.py:1.1.2.17

Jim Fulton jim@zope.com
Sun, 3 Feb 2002 18:31:16 -0500


Update of /cvs-repository/Zope3
In directory cvs.zope.org:/tmp/cvs-serv28974

Modified Files:
      Tag: Zope-3x-branch
	z3.py 
Log Message:
Moved the responsability for initially creating a Zope application
object from ZopePublication to the Zope main program, currently z3.py.


=== Zope3/z3.py 1.1.2.16 => 1.1.2.17 ===
 from Zope.Server.HTTPServer import CommonHitLogger
 
+from Zope.App.ZopePublication.ZopePublication import ZopePublication
+
 from ZODB.FileStorage import FileStorage
 from ZODB import DB
 
@@ -41,6 +43,23 @@
 zLOG._set_log_dest(sys.stderr)
 
 DB = DB(FileStorage('Data.fs'))
+
+connection = DB.open()
+root = connection.root()
+app = getattr(root, ZopePublication.root_name, None)
+
+if app is None:
+    from Zope.App.OFS.Folder.RootFolder import RootFolder
+    from Transaction import get_transaction
+    
+    app = RootFolder()
+    root[ZopePublication.root_name] = app
+
+    get_transaction().commit()
+    
+connection.close()
+
+
 publication = BrowserPublication(DB)
 request_payload = BrowserRequestPayload(publication)
 response_payload = BrowserResponsePayload()