Commit baa68c50 authored by Jim Fulton's avatar Jim Fulton

Moved Python 1.x compatable asyncx to their own package that takes

care of installing them when necessary (not for Python 2.0)

Now import asyncore and asynchat as top-level modules, rather than
from the medusa package. This makes it easier to use our custum
version for Python 1.5 and to use the standard versions for Python
2.x.

Note that the Python 2.1b1 and 2.1b2 releases had a broken asynchat
that causes these changes to break Zope. The Python cvs and earler and
later versions are OK.
parent 2e1a795d
...@@ -99,7 +99,8 @@ __version__ = "1.0" ...@@ -99,7 +99,8 @@ __version__ = "1.0"
#---------------------------------------------------------------------- #----------------------------------------------------------------------
from medusa import asynchat, asyncore, logger import asynchat, asyncore
from medusa import logger
from medusa.counter import counter from medusa.counter import counter
from medusa.http_server import compute_timezone_for_log from medusa.http_server import compute_timezone_for_log
......
...@@ -138,7 +138,8 @@ FTP Authorization ...@@ -138,7 +138,8 @@ FTP Authorization
from PubCore import handle from PubCore import handle
from medusa.ftp_server import ftp_channel, ftp_server, recv_channel from medusa.ftp_server import ftp_channel, ftp_server, recv_channel
from medusa import asyncore, asynchat, filesys import asyncore, asynchat
from medusa import filesys
from FTPResponse import make_response from FTPResponse import make_response
from FTPRequest import FTPRequest from FTPRequest import FTPRequest
......
...@@ -96,7 +96,8 @@ from ZPublisher.HTTPResponse import HTTPResponse ...@@ -96,7 +96,8 @@ from ZPublisher.HTTPResponse import HTTPResponse
from medusa.http_date import build_http_date from medusa.http_date import build_http_date
from PubCore.ZEvent import Wakeup from PubCore.ZEvent import Wakeup
from medusa.producers import hooked_producer from medusa.producers import hooked_producer
from medusa import http_server, asyncore from medusa import http_server
import asyncore
from Producers import ShutdownProducer, LoggingProducer, CallbackProducer, \ from Producers import ShutdownProducer, LoggingProducer, CallbackProducer, \
file_part_producer, file_close_producer file_part_producer, file_close_producer
from types import LongType from types import LongType
......
...@@ -118,9 +118,10 @@ from HTTPResponse import make_response ...@@ -118,9 +118,10 @@ from HTTPResponse import make_response
from ZPublisher.HTTPRequest import HTTPRequest from ZPublisher.HTTPRequest import HTTPRequest
from medusa.http_server import http_server, http_channel, VERSION_STRING from medusa.http_server import http_server, http_channel, VERSION_STRING
from medusa import counter, producers, asyncore, max_sockets import asyncore
from medusa import counter, producers, max_sockets
from medusa.default_handler import split_path, unquote, get_header from medusa.default_handler import split_path, unquote, get_header
from medusa.asyncore import compact_traceback, dispatcher from asyncore import compact_traceback, dispatcher
from ZServer import CONNECTION_LIMIT, ZOPE_VERSION, ZSERVER_VERSION from ZServer import CONNECTION_LIMIT, ZOPE_VERSION, ZSERVER_VERSION
from ZServer import requestCloseOnExec from ZServer import requestCloseOnExec
......
...@@ -100,10 +100,11 @@ environment and headers completely. ...@@ -100,10 +100,11 @@ environment and headers completely.
Note that ZServer can operate multiple PCGI servers. Note that ZServer can operate multiple PCGI servers.
""" """
from medusa import asynchat, asyncore, logger from medusa import logger
import asynchat, asyncore
from medusa.counter import counter from medusa.counter import counter
from medusa.http_server import compute_timezone_for_log from medusa.http_server import compute_timezone_for_log
from medusa.asyncore import compact_traceback from asyncore import compact_traceback
from ZServer import CONNECTION_LIMIT, requestCloseOnExec from ZServer import CONNECTION_LIMIT, requestCloseOnExec
......
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
ZServer pipe utils. These producers basically function as callbacks. ZServer pipe utils. These producers basically function as callbacks.
""" """
from medusa import asyncore import asyncore
import sys import sys
class ShutdownProducer: class ShutdownProducer:
......
...@@ -84,10 +84,12 @@ ...@@ -84,10 +84,12 @@
############################################################################## ##############################################################################
import sys import sys
from medusa import max_sockets, asyncore from medusa import max_sockets
# We need to make sure *our* asyncore is *the* asyncore # We want to use updated asynchat and asyncore if using Python1
sys.modules['asyncore']=asyncore if sys.version[:1] < '2':
import async1x
del async1x
CONNECTION_LIMIT=max_sockets.max_select_sockets() CONNECTION_LIMIT=max_sockets.max_select_sockets()
...@@ -115,7 +117,7 @@ try: ...@@ -115,7 +117,7 @@ try:
else: else:
LOG('ZServer', severity[type], message) LOG('ZServer', severity[type], message)
from medusa import asyncore import asyncore
asyncore.dispatcher.log_info=log_info asyncore.dispatcher.log_info=log_info
except: except:
pass pass
...@@ -135,7 +137,8 @@ except (ImportError, AttributeError): ...@@ -135,7 +137,8 @@ except (ImportError, AttributeError):
def requestCloseOnExec(sock): def requestCloseOnExec(sock):
pass pass
from medusa import resolver, logger, asyncore import asyncore
from medusa import resolver, logger
from HTTPServer import zhttp_server, zhttp_handler from HTTPServer import zhttp_server, zhttp_handler
from PCGIServer import PCGIServer from PCGIServer import PCGIServer
from FCGIServer import FCGIServer from FCGIServer import FCGIServer
......
...@@ -99,7 +99,8 @@ __version__ = "1.0" ...@@ -99,7 +99,8 @@ __version__ = "1.0"
#---------------------------------------------------------------------- #----------------------------------------------------------------------
from medusa import asynchat, asyncore, logger import asynchat, asyncore
from medusa import logger
from medusa.counter import counter from medusa.counter import counter
from medusa.http_server import compute_timezone_for_log from medusa.http_server import compute_timezone_for_log
......
...@@ -138,7 +138,8 @@ FTP Authorization ...@@ -138,7 +138,8 @@ FTP Authorization
from PubCore import handle from PubCore import handle
from medusa.ftp_server import ftp_channel, ftp_server, recv_channel from medusa.ftp_server import ftp_channel, ftp_server, recv_channel
from medusa import asyncore, asynchat, filesys import asyncore, asynchat
from medusa import filesys
from FTPResponse import make_response from FTPResponse import make_response
from FTPRequest import FTPRequest from FTPRequest import FTPRequest
......
...@@ -96,7 +96,8 @@ from ZPublisher.HTTPResponse import HTTPResponse ...@@ -96,7 +96,8 @@ from ZPublisher.HTTPResponse import HTTPResponse
from medusa.http_date import build_http_date from medusa.http_date import build_http_date
from PubCore.ZEvent import Wakeup from PubCore.ZEvent import Wakeup
from medusa.producers import hooked_producer from medusa.producers import hooked_producer
from medusa import http_server, asyncore from medusa import http_server
import asyncore
from Producers import ShutdownProducer, LoggingProducer, CallbackProducer, \ from Producers import ShutdownProducer, LoggingProducer, CallbackProducer, \
file_part_producer, file_close_producer file_part_producer, file_close_producer
from types import LongType from types import LongType
......
...@@ -118,9 +118,10 @@ from HTTPResponse import make_response ...@@ -118,9 +118,10 @@ from HTTPResponse import make_response
from ZPublisher.HTTPRequest import HTTPRequest from ZPublisher.HTTPRequest import HTTPRequest
from medusa.http_server import http_server, http_channel, VERSION_STRING from medusa.http_server import http_server, http_channel, VERSION_STRING
from medusa import counter, producers, asyncore, max_sockets import asyncore
from medusa import counter, producers, max_sockets
from medusa.default_handler import split_path, unquote, get_header from medusa.default_handler import split_path, unquote, get_header
from medusa.asyncore import compact_traceback, dispatcher from asyncore import compact_traceback, dispatcher
from ZServer import CONNECTION_LIMIT, ZOPE_VERSION, ZSERVER_VERSION from ZServer import CONNECTION_LIMIT, ZOPE_VERSION, ZSERVER_VERSION
from ZServer import requestCloseOnExec from ZServer import requestCloseOnExec
......
...@@ -100,10 +100,11 @@ environment and headers completely. ...@@ -100,10 +100,11 @@ environment and headers completely.
Note that ZServer can operate multiple PCGI servers. Note that ZServer can operate multiple PCGI servers.
""" """
from medusa import asynchat, asyncore, logger from medusa import logger
import asynchat, asyncore
from medusa.counter import counter from medusa.counter import counter
from medusa.http_server import compute_timezone_for_log from medusa.http_server import compute_timezone_for_log
from medusa.asyncore import compact_traceback from asyncore import compact_traceback
from ZServer import CONNECTION_LIMIT, requestCloseOnExec from ZServer import CONNECTION_LIMIT, requestCloseOnExec
......
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
ZServer pipe utils. These producers basically function as callbacks. ZServer pipe utils. These producers basically function as callbacks.
""" """
from medusa import asyncore import asyncore
import sys import sys
class ShutdownProducer: class ShutdownProducer:
......
...@@ -84,10 +84,12 @@ ...@@ -84,10 +84,12 @@
############################################################################## ##############################################################################
import sys import sys
from medusa import max_sockets, asyncore from medusa import max_sockets
# We need to make sure *our* asyncore is *the* asyncore # We want to use updated asynchat and asyncore if using Python1
sys.modules['asyncore']=asyncore if sys.version[:1] < '2':
import async1x
del async1x
CONNECTION_LIMIT=max_sockets.max_select_sockets() CONNECTION_LIMIT=max_sockets.max_select_sockets()
...@@ -115,7 +117,7 @@ try: ...@@ -115,7 +117,7 @@ try:
else: else:
LOG('ZServer', severity[type], message) LOG('ZServer', severity[type], message)
from medusa import asyncore import asyncore
asyncore.dispatcher.log_info=log_info asyncore.dispatcher.log_info=log_info
except: except:
pass pass
...@@ -135,7 +137,8 @@ except (ImportError, AttributeError): ...@@ -135,7 +137,8 @@ except (ImportError, AttributeError):
def requestCloseOnExec(sock): def requestCloseOnExec(sock):
pass pass
from medusa import resolver, logger, asyncore import asyncore
from medusa import resolver, logger
from HTTPServer import zhttp_server, zhttp_handler from HTTPServer import zhttp_server, zhttp_handler
from PCGIServer import PCGIServer from PCGIServer import PCGIServer
from FCGIServer import FCGIServer from FCGIServer import FCGIServer
......
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