Commit 73a33311 authored by Tres Seaver's avatar Tres Seaver

Backport removal of experimental support for configuring the Twisted HTTP...

Backport removal of experimental support for configuring the Twisted HTTP server as an alternative to ``ZServer``.
parent 70922ece
......@@ -21,6 +21,9 @@ Features Added
Bugs Fixed
++++++++++
- Backported removal of experimental support for configuring the Twisted HTTP
server as an alternative to ``ZServer``.
- Backported fix for timezone issues in date index tests from trunk.
- LP #414757 (backported from Zope trunk): don't emit a IEndRequestEvent when
......
......@@ -31,11 +31,6 @@ def shutdown(exit_code,fast = 0):
import ZServer
ZServer.exit_code = exit_code
_shutdown_phase = 1
try:
from twisted.internet import reactor
reactor.callLater(0.1, reactor.stop)
except ImportError:
pass
if fast:
# Someone wants us to shutdown fast. This is hooked into SIGTERM - so
# possibly the system is going down and we can expect a SIGKILL within
......
......@@ -20,12 +20,6 @@ import sys
import socket
from re import compile
from socket import gethostbyaddr
try:
import twisted.internet.reactor
_use_twisted = True
except ImportError:
_use_twisted = True
import ZConfig
from ZConfig.components.logger import loghandler
......@@ -94,7 +88,6 @@ class ZopeStarter:
self.serverListen()
from App.config import getConfiguration
config = getConfiguration()
if not config.twisted_servers:
self.registerSignals()
# emit a "ready" message in order to prevent the kinds of emails
# to the Zope maillist in which people claim that Zope has "frozen"
......@@ -109,18 +102,6 @@ class ZopeStarter:
from App.config import getConfiguration
config = getConfiguration()
import ZServer
if config.twisted_servers and config.servers:
raise ZConfig.ConfigurationError(
"You can't run both ZServer servers and twisted servers.")
if config.twisted_servers:
if not _use_twisted:
raise ZConfig.ConfigurationError(
"You do not have twisted installed.")
twisted.internet.reactor.run()
# Storing the exit code in the ZServer even for twisted,
# but hey, it works...
sys.exit(ZServer.exit_code)
else:
import Lifetime
Lifetime.loop()
sys.exit(ZServer.exit_code)
......
......@@ -325,12 +325,3 @@ def simpleClassFactory(jar, module, name,
return getattr(m, name)
except:
return OFS.Uninstalled.Broken(jar, None, (module, name))
try:
from zope.app.twisted.server import ServerFactory
class TwistedServerFactory(ServerFactory):
pass
except ImportError:
class TwistedServerFactory:
def __init__(self, section):
raise ImportError("You do not have twisted installed.")
......@@ -5,29 +5,6 @@ import logging
from re import compile
from socket import gethostbyaddr
try:
import twisted.internet
from twisted.application.service import MultiService
import zope.app.twisted.main
import twisted.web2.wsgi
import twisted.web2.server
import twisted.web2.log
try:
from twisted.web2.http import HTTPFactory
except ImportError:
from twisted.web2.channel.http import HTTPFactory
from zope.component import provideUtility
from zope.app.twisted.server import ServerType, SSLServerType
from zope.app.twisted.interfaces import IServerType
from ZPublisher.WSGIPublisher import publish_module
_use_twisted = True
except ImportError:
_use_twisted = False
# top-level key handlers
......@@ -228,23 +205,6 @@ def root_handler(config):
config.cgi_environment,
config.port_base)
if not config.twisted_servers:
config.twisted_servers = []
else:
# Set number of threads (reuse zserver_threads variable)
twisted.internet.reactor.suggestThreadPoolSize(config.zserver_threads)
# Create a root service
rootService = MultiService()
for server in config.twisted_servers:
service = server.create(None)
service.setServiceParent(rootService)
rootService.startService()
twisted.internet.reactor.addSystemEventTrigger(
'before', 'shutdown', rootService.stopService)
# set up trusted proxies
if config.trusted_proxies:
import ZPublisher.HTTPRequest
......@@ -264,23 +224,12 @@ def handleConfig(config, multihandler):
# DM 2004-11-24: added
def _name2Ips(host, isIp_=compile(r'(\d+\.){3}').match):
'''map a name *host* to the sequence of its ip addresses;
"""Map a name *host* to the sequence of its ip addresses.
use *host* itself (as sequence) if it already is an ip address.
Thus, if only a specific interface on a host is trusted,
identify it by its ip (and not the host name).
'''
if isIp_(host): return [host]
"""
if isIp_(host):
return [host]
return gethostbyaddr(host)[2]
# Twisted support:
def createHTTPFactory(ignored):
resource = twisted.web2.wsgi.WSGIResource(publish_module)
resource = twisted.web2.log.LogWrapperResource(resource)
return HTTPFactory(twisted.web2.server.Site(resource))
if _use_twisted:
http = ServerType(createHTTPFactory, 8080)
provideUtility(http, IServerType, 'Zope2-HTTP')
......@@ -11,12 +11,6 @@
<import package="tempstorage"/>
<import package="Zope2.Startup" file="warnfilter.xml"/>
<sectiontype name="server" datatype="Zope2.Startup.datatypes.TwistedServerFactory">
<key name="type" required="yes" />
<key name="address" datatype="inet-address" />
<key name="backlog" datatype="integer" default="50" />
</sectiontype>
<sectiontype name="logger" datatype=".LoggerFactory">
<description>
This "logger" type only applies to access and request ("trace")
......@@ -878,7 +872,6 @@
<metadefault>on</metadefault>
</key>
<multisection type="server" name="*" attribute="twisted_servers" />
<multisection type="ZServer.server" name="*" attribute="servers"/>
<key name="port-base" datatype="integer" default="0">
......
......@@ -1005,14 +1005,6 @@ instancehome $INSTANCE
# user admin
# password 123
# </clock-server>
#
# <server>
# # This uses Twisted as the web-server. You must install Twisted
# # separately. You can't run Twisted and ZServer at same time.
# address 8080
# type Zope2-HTTP
# </server>
# Database (zodb_db) section
#
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment