[Zope-Checkins] CVS: Zope3 - startup.zcml:1.1.2.1 site.zcml:1.1.2.6 z3.py:1.1.2.27
Stephan Richter
srichter@cbu.edu
Fri, 29 Mar 2002 14:44:50 -0500
Update of /cvs-repository/Zope3
In directory cvs.zope.org:/tmp/cvs-serv18519
Modified Files:
Tag: Zope-3x-branch
site.zcml z3.py
Added Files:
Tag: Zope-3x-branch
startup.zcml
Log Message:
This is a first tackle of creating a Zope startup configuration file. It is
not very flexible at the moment, simply because I do not know what is ahead
of us. However, I think it is better than what we had before.
Features:
- Specify the types of servers you want to start
- Decide which type of ZODB storage to use
- Decide where the logs should be written to.
Planned (if agreed with by the community):
- Make a server type registry, where developers can register new servers,
so that the site admin has only to select them and is not challenged with
implementation details.
- Make a second registry for ZODB storage type for the same reasons as
above.
- Split the startup configuration into two sections:
1. The programmer directives, that do all the low level stuff and provide
the services for the higher level settings.
2. The Site Admin directives, which then use the objects, which were
provided by the programmers
=== Added File Zope3/startup.zcml ===
<zopeConfigure
xmlns="http://namespaces.zope.org/zope"
xmlns:startup="http://namespaces.zope.org/startup">
<startup:defineSite name="Zope 3 Default"
threads="4">
<startup:useStorage factory = "ZODB.FileStorage."
file = "Data.fs" />
<startup:useLog file="STDERR" />
<startup:addServer type = "Browser"
port = "8080"
verbose = "true"
logClass = "Zope.Server.HTTPServer.CommonHitLogger." />
<startup:addServer type = "XML-RPC"
port = "8081"
verbose = "true"
logClass = "Zope.Server.HTTPServer.CommonHitLogger." />
</startup:defineSite>
</zopeConfigure>
=== Zope3/site.zcml 1.1.2.5 => 1.1.2.6 ===
<include file="products.zcml" />
+
+<!-- Now start Zope -->
+<include file="startup.zcml" />
+
</zopeConfigure>
=== Zope3/z3.py 1.1.2.26 => 1.1.2.27 ===
$Id$
"""
-import sys, os
-sys.setcheckinterval(120)
+import os, sys, asyncore
+# setting python paths
program = sys.argv[0]
here = os.path.join(os.getcwd(), os.path.split(program)[0])
sys.path=[os.path.join(here,'lib','python'),
here] + filter(None, sys.path)
-from Zope.Publisher.Browser.BrowserRequest import BrowserRequest
-from Zope.App.ZopePublication.Browser.Publication import BrowserPublication
-
-from Zope.Publisher.XMLRPC.XMLRPCRequest import XMLRPCRequest
-from Zope.App.ZopePublication.XMLRPC.Publication import XMLRPCPublication
-
-
-from Zope.App.Security.SimpleSecurityPolicies \
- import PermissiveSecurityPolicy
-from Zope.App.Security.SecurityManager import setSecurityPolicy
-from Zope.App.OFS.Folder.RootFolder import RootFolder
-import asyncore, zLOG
-from Zope.Server import ZLogIntegration
-from Zope.Server.PublisherServers import PublisherHTTPServer
-from Zope.Server.TaskThreads import ThreadedTaskDispatcher
-from Zope.Server.HTTPServer import CommonHitLogger
-from Zope.App.ZopePublication.ZopePublication import ZopePublication
-
-import asyncore, zLOG
-
-from ZODB.FileStorage import FileStorage
-from ZODB import DB
-
+from Zope.Configuration import config
+from Zope.Configuration.xmlconfig import XMLConfig
# temp hack
-from Zope.Configuration import config
config(os.getcwd())
-
-
-zLOG._set_log_dest(sys.stderr)
-
-DB = DB(FileStorage('Data.fs'))
-from Zope.ComponentArchitecture import provideUtility
-from Zope.App.Undo.ZODBUndoManager import ZODBUndoManager
-from Zope.App.Undo.IUndoManager import IUndoManager
-provideUtility(IUndoManager, ZODBUndoManager(DB))
-
-
-connection = DB.open()
-root = connection.root()
-app = root.get(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()
-
-
-browser_publication = BrowserPublication(DB)
-def browser_request_factory(input_stream, output_steam, env):
- request = BrowserRequest(input_stream, output_steam, env)
- request.setPublication(browser_publication)
- return request
-
-
-xmlrpc_publication = XMLRPCPublication(DB)
-def xmlrpc_request_factory(input_stream, output_steam, env):
- request = XMLRPCRequest(input_stream, output_steam, env)
- request.setPublication(xmlrpc_publication)
- return request
-
-
-td = ThreadedTaskDispatcher()
-td.setThreadCount(4)
-
-hit_log = CommonHitLogger()
-PublisherHTTPServer(browser_request_factory, 'Browser',
- '', 8080, task_dispatcher=td, verbose=1, hit_log=hit_log)
-
-PublisherHTTPServer(xmlrpc_request_factory, 'XML-RPC',
- '', 8081, task_dispatcher=td, verbose=1, hit_log=hit_log)
-
try:
asyncore.loop()