Skip to content

Commit

Permalink
Move new Zope2.startup.config module into ZServer.
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed Aug 7, 2016
1 parent 33f72dc commit 70b5d92
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 39 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
2 changes: 1 addition & 1 deletion src/Testing/ZopeTestCase/threadutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
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
Expand Down
7 changes: 5 additions & 2 deletions src/ZPublisher/HTTPResponse.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,12 @@ def _requestShutdown(self, exitCode=0):
""" 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.
Expand Down
30 changes: 0 additions & 30 deletions src/Zope2/Startup/config.py

This file was deleted.

31 changes: 26 additions & 5 deletions src/Zope2/Startup/handlers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
##############################################################################
#
# 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):
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 70b5d92

Please sign in to comment.