[Zope-Checkins] CVS: Zope3 - z3.py:1.1.2.26
Stephan Richter
srichter@cbu.edu
Wed, 27 Mar 2002 10:08:58 -0500
Update of /cvs-repository/Zope3
In directory cvs.zope.org:/tmp/cvs-serv850
Modified Files:
Tag: Zope-3x-branch
z3.py
Log Message:
- activate XML-RPC server
=== Zope3/z3.py 1.1.2.25 => 1.1.2.26 ===
-# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
-# Version 1.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
+# FOR A PARTICULAR PURPOSE
+#
+##############################################################################
+"""
+
+$Id$
+"""
import sys, os
sys.setcheckinterval(120)
@@ -16,10 +25,13 @@
sys.path=[os.path.join(here,'lib','python'),
here] + filter(None, sys.path)
-from Zope.App.ZopePublication.Browser.Publication import PublicationFactory
from Zope.Publisher.Browser.BrowserRequest import BrowserRequest
-from Zope.Publisher.Browser.IBrowserPublisher import IBrowserPublisher
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
@@ -67,10 +79,17 @@
connection.close()
-publication = BrowserPublication(DB)
-def request_factory(input_stream, output_steam, env):
+browser_publication = BrowserPublication(DB)
+def browser_request_factory(input_stream, output_steam, env):
request = BrowserRequest(input_stream, output_steam, env)
- request.setPublication(publication)
+ 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
@@ -78,9 +97,11 @@
td.setThreadCount(4)
hit_log = CommonHitLogger()
-PublisherHTTPServer(request_factory,
+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: