Commit 70b5d923 authored by Hanno Schlichting's avatar Hanno Schlichting

Move new Zope2.startup.config module into ZServer.

parent 33f72dcb
......@@ -42,7 +42,7 @@ Restructuring
- Split a WSGI part out of `Zope2.Startup.ZopeStarter`.
- Add new `Zope2.Startup.config` module to hold configuration.
- Add new `ZServer.Zope2.Startup.config` module to hold configuration.
- Remove `Control_Panel` `/DebugInfo` and `/DavLocks`.
......
......@@ -23,7 +23,7 @@ dummyLOG = StringIO()
def setNumberOfThreads(number_of_threads):
'''Sets number of ZServer threads.'''
try:
from Zope2.Startup.config import setNumberOfThreads
from ZServer.Zope2.Startup.config import setNumberOfThreads
setNumberOfThreads(number_of_threads)
except ImportError:
pass
......
......@@ -564,9 +564,12 @@ class HTTPResponse(BaseResponse):
""" Request that the server shut down with exitCode after fulfilling
the current request.
"""
from Zope2.Startup import config
config.ZSERVER_EXIT_CODE = exitCode
self._shutdown_flag = 1
try:
from ZServer.Zope2.Startup import config
config.ZSERVER_EXIT_CODE = exitCode
except ImportError:
pass
def _shutdownRequested(self):
""" Returns true if this request requested a server shutdown.
......
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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.
#
##############################################################################
TRUSTED_PROXIES = []
ZSERVER_CONNECTION_LIMIT = 1000
ZSERVER_ENABLE_MS_PUBLIC_HEADER = False
ZSERVER_EXIT_CODE = 0
ZSERVER_LARGE_FILE_THRESHOLD = 524288
ZSERVER_THREADS = 1
def setNumberOfThreads(n):
"""This function will self-destruct in 4 statements.
"""
global ZSERVER_THREADS
ZSERVER_THREADS = n
global setNumberOfThreads
del setNumberOfThreads
##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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.
#
##############################################################################
import os
import re
import sys
from socket import gethostbyaddr
from Zope2.Startup import config
try:
from ZServer.Zope2.Startup import config
except ImportError:
config = None
def _setenv(name, value):
......@@ -57,7 +74,8 @@ def session_timeout_minutes(value):
def large_file_threshold(value):
config.ZSERVER_LARGE_FILE_THRESHOLD = value
if config:
config.ZSERVER_LARGE_FILE_THRESHOLD = value
def http_realm(value):
......@@ -66,7 +84,8 @@ def http_realm(value):
def max_listen_sockets(value):
config.ZSERVER_CONNECTION_LIMIT = value
if config:
config.ZSERVER_CONNECTION_LIMIT = value
def cgi_maxlen(value):
......@@ -79,7 +98,8 @@ def http_header_max_length(value):
def enable_ms_public_header(value):
config.ZSERVER_ENABLE_MS_PUBLIC_HEADER = value
if config:
config.ZSERVER_ENABLE_MS_PUBLIC_HEADER = value
def root_handler(cfg):
......@@ -131,7 +151,8 @@ def root_handler(cfg):
mapped = []
for name in cfg.trusted_proxies:
mapped.extend(_name_to_ips(name))
config.TRUSTED_PROXIES = tuple(mapped)
if config:
config.TRUSTED_PROXIES = tuple(mapped)
from ZPublisher import HTTPRequest
HTTPRequest.trusted_proxies = tuple(mapped)
......
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