[Zope-Checkins] SVN: Zope/branches/regebro-wsgi_support2/lib/python/Zope2/Startup/ More twisted imports handled.

Lennart Regebro regebro at gmail.com
Sun Apr 30 12:25:51 EDT 2006


Log message for revision 67770:
  More twisted imports handled.
  

Changed:
  U   Zope/branches/regebro-wsgi_support2/lib/python/Zope2/Startup/__init__.py
  U   Zope/branches/regebro-wsgi_support2/lib/python/Zope2/Startup/datatypes.py
  U   Zope/branches/regebro-wsgi_support2/lib/python/Zope2/Startup/zopeschema.xml

-=-
Modified: Zope/branches/regebro-wsgi_support2/lib/python/Zope2/Startup/__init__.py
===================================================================
--- Zope/branches/regebro-wsgi_support2/lib/python/Zope2/Startup/__init__.py	2006-04-30 16:13:46 UTC (rev 67769)
+++ Zope/branches/regebro-wsgi_support2/lib/python/Zope2/Startup/__init__.py	2006-04-30 16:25:51 UTC (rev 67770)
@@ -20,7 +20,12 @@
 import socket
 from re import compile
 from socket import gethostbyaddr
-import twisted.internet.reactor
+try:
+    import twisted.internet.reactor
+    _use_twisted = True
+except ImportError:
+    _use_twisted = True
+    
 
 import ZConfig
 from ZConfig.components.logger import loghandler
@@ -111,6 +116,8 @@
             from App.config import getConfiguration
             config = getConfiguration()
             if config.twisted_servers:
+                if not _use_twisted:
+                    raise ValueError, "You do not have twisted installed."
                 twisted.internet.reactor.run()
             else:
                 import ZServer

Modified: Zope/branches/regebro-wsgi_support2/lib/python/Zope2/Startup/datatypes.py
===================================================================
--- Zope/branches/regebro-wsgi_support2/lib/python/Zope2/Startup/datatypes.py	2006-04-30 16:13:46 UTC (rev 67769)
+++ Zope/branches/regebro-wsgi_support2/lib/python/Zope2/Startup/datatypes.py	2006-04-30 16:25:51 UTC (rev 67770)
@@ -339,3 +339,10 @@
 # Zope class factory."  This no longer works with the implementation of
 # 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

Modified: Zope/branches/regebro-wsgi_support2/lib/python/Zope2/Startup/zopeschema.xml
===================================================================
--- Zope/branches/regebro-wsgi_support2/lib/python/Zope2/Startup/zopeschema.xml	2006-04-30 16:13:46 UTC (rev 67769)
+++ Zope/branches/regebro-wsgi_support2/lib/python/Zope2/Startup/zopeschema.xml	2006-04-30 16:25:51 UTC (rev 67770)
@@ -11,7 +11,7 @@
   <import package="tempstorage"/>
   <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="address" datatype="inet-address" />
     <key name="backlog" datatype="integer" default="50" />



More information about the Zope-Checkins mailing list