Commit fd89cf9b authored by Lennart Regebro's avatar Lennart Regebro

More twisted imports handled.

parent 87be8d16
...@@ -20,7 +20,12 @@ import sys ...@@ -20,7 +20,12 @@ import sys
import socket import socket
from re import compile from re import compile
from socket import gethostbyaddr from socket import gethostbyaddr
import twisted.internet.reactor try:
import twisted.internet.reactor
_use_twisted = True
except ImportError:
_use_twisted = True
import ZConfig import ZConfig
from ZConfig.components.logger import loghandler from ZConfig.components.logger import loghandler
...@@ -111,6 +116,8 @@ class ZopeStarter: ...@@ -111,6 +116,8 @@ class ZopeStarter:
from App.config import getConfiguration from App.config import getConfiguration
config = getConfiguration() config = getConfiguration()
if config.twisted_servers: if config.twisted_servers:
if not _use_twisted:
raise ValueError, "You do not have twisted installed."
twisted.internet.reactor.run() twisted.internet.reactor.run()
else: else:
import ZServer import ZServer
......
...@@ -339,3 +339,10 @@ def zopeClassFactory(jar, module, name, ...@@ -339,3 +339,10 @@ def zopeClassFactory(jar, module, name,
# Zope class factory." This no longer works with the implementation of # Zope class factory." This no longer works with the implementation of
# mounted databases, so we just use the zopeClassFactory as the default # mounted databases, so we just use the zopeClassFactory as the default
try:
from zope.app.twisted.server import ServerFactory
class TwistedServerFactory(ServerFactory):
pass
except ImportError:
class TwistedServerFactory:
pass
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<import package="tempstorage"/> <import package="tempstorage"/>
<import package="Zope2.Startup" file="warnfilter.xml"/> <import package="Zope2.Startup" file="warnfilter.xml"/>
<sectiontype name="server" datatype="zope.app.twisted.server.ServerFactory"> <sectiontype name="server" datatype="Zope2.Startup.datatypes.TwistedServerFactory">
<key name="type" required="yes" /> <key name="type" required="yes" />
<key name="address" datatype="inet-address" /> <key name="address" datatype="inet-address" />
<key name="backlog" datatype="integer" default="50" /> <key name="backlog" datatype="integer" default="50" />
......
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