Skip to content

Commit

Permalink
Copy startup and zope.conf parsing logic to ZServer.
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed Aug 7, 2016
1 parent 519ca22 commit 95d7a66
Show file tree
Hide file tree
Showing 21 changed files with 142 additions and 872 deletions.
123 changes: 0 additions & 123 deletions develop/ZServer/src/ZServer/Zope2/Startup/tests/test_warnfilter.py

This file was deleted.

7 changes: 3 additions & 4 deletions src/App/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

_config = None


def getConfiguration():
"""Return the global Zope configuration object.
Expand All @@ -25,6 +26,7 @@ def getConfiguration():
setConfiguration(DefaultConfiguration())
return _config


def setConfiguration(cfg):
"""Set the global configuration object.
Expand Down Expand Up @@ -54,6 +56,7 @@ def setConfiguration(cfg):

Globals.DevelopmentMode = cfg.debug_mode


class DefaultConfiguration:
"""
This configuration should be used effectively only during unit tests
Expand All @@ -64,12 +67,8 @@ def __init__(self):
self.instancehome = FindHomes.INSTANCE_HOME
self.dbtab = None
self.debug_mode = True
self.enable_product_installation = False
self.locale = None

# ZServer.HTTPServer
self.http_header_max_length = 8196

# VerboseSecurity
self.skip_ownership_checking = False
self.skip_authentication_checking = False
6 changes: 3 additions & 3 deletions src/OFS/tests/testAcquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@

from Testing.makerequest import makerequest

import Zope2
Zope2.startup()

from OFS.SimpleItem import SimpleItem
from AccessControl import ClassSecurityInfo
from AccessControl.class_init import InitializeClass
Expand All @@ -33,6 +30,9 @@
from AccessControl.ImplPython import guarded_getattr as guarded_getattr_py
from AccessControl.ImplC import guarded_getattr as guarded_getattr_c

import Zope2
Zope2.startup_wsgi()


class AllowedItem(SimpleItem):
id = 'allowed'
Expand Down
2 changes: 1 addition & 1 deletion src/OFS/tests/testCopySupportEvents.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from Testing.makerequest import makerequest
from Zope2.App import zcml

Zope2.startup()
Zope2.startup_wsgi()


class EventLogger(object):
Expand Down
2 changes: 1 addition & 1 deletion src/OFS/tests/testCopySupportHooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from Zope2.App import zcml

Zope2.startup()
Zope2.startup_wsgi()


class EventLogger(object):
Expand Down
2 changes: 1 addition & 1 deletion src/OFS/tests/testFileAndImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
imagedata = os.path.join(here, 'test.gif')
filedata = os.path.join(here, 'test.gif')

Zope2.startup()
Zope2.startup_wsgi()


def makeConnection():
Expand Down
12 changes: 6 additions & 6 deletions src/OFS/tests/testHistory.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import unittest
import Zope2
Zope2.startup()

import os
import shutil
import time
import transaction
import tempfile
import unittest

import transaction
import ZODB
from ZODB.FileStorage import FileStorage

from OFS.Application import Application
from OFS.History import Historical
from OFS.SimpleItem import SimpleItem
from ZODB.FileStorage import FileStorage
import Zope2
Zope2.startup_wsgi()


class HistoryItem(SimpleItem, Historical):
Expand Down
3 changes: 2 additions & 1 deletion src/Testing/ZopeTestCase/ZopeLite.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def _configure_client_cache():

_exec('import Zope2')
import Zope2
import Zope2.Startup.run
_exec('import ZODB')
import ZODB
_write('.')
Expand Down Expand Up @@ -214,7 +215,7 @@ def _installPackage(name, quiet=0):
app = Zope2.app
debug = Zope2.debug
DB = Zope2.DB
configure = Zope2.configure
configure = Zope2.Startup.run.configure_wsgi
def startup(): pass
Zope = Zope2
active = _patched
Expand Down
2 changes: 1 addition & 1 deletion src/ZPublisher/tests/testPostTraversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from ZPublisher.HTTPResponse import HTTPResponse
import Zope2

Zope2.startup()
Zope2.startup_wsgi()

pt_simple_was_run = 0

Expand Down
17 changes: 4 additions & 13 deletions src/Zope2/Startup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,18 @@

from __future__ import absolute_import

import sys

from zope.deferredimport import deprecated

# BBB Zope 5.0
deprecated(
'Please import from ZServer.Zope2.Startup.starter',
get_starter='ZServer.Zope2.Startup.starter:get_starter',
UnixZopeStarter='ZServer.Zope2.Startup.starter:UnixZopeStarter',
WindowsZopeStarter='ZServer.Zope2.Startup.starter:WindowsZopeStarter',
ZopeStarter='ZServer.Zope2.Startup.starter:ZopeStarter',
)


def get_starter(wsgi=False):
if wsgi:
from Zope2.Startup.starter import WSGIStarter
return WSGIStarter()
else:
if sys.platform[:3].lower() == "win":
from ZServer.Zope2.Startup.starter import WindowsZopeStarter
return WindowsZopeStarter()
else:
from ZServer.Zope2.Startup.starter import UnixZopeStarter
return UnixZopeStarter()
def get_wsgi_starter():
from Zope2.Startup.starter import WSGIStarter
return WSGIStarter()
Loading

0 comments on commit 95d7a66

Please sign in to comment.