Add Zope 2.12 compatibility to the testrunner

Configure the ZopeLite layer, enabling conditional product installation.

Conditionally load zcml on Zope 2.12 and delay the optimize and fortify calls
until after Product initialization by the layer.

Disable printing of profiling information on Zope 2.12 since profiling support
on ZopeTestCase has been removed.

Import copyzopeskel from its proper location on Zope 2.12 (this has a side-
effect of changing slightly the beginning of the test output, suppressing the
"Loading Zope, please stand by ..." initial message). Additionally, add a Zope
2.12 compatible skeleton.

Make sure the skin is configured on the portal object, since it's no longer
configured automatically by acquisition on CMF 2.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30352 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7cdbe011
......@@ -65,6 +65,21 @@ ZopeTestCase.installProduct('MailHost', quiet=install_product_quiet)
ZopeTestCase.installProduct('PageTemplates', quiet=install_product_quiet)
ZopeTestCase.installProduct('PythonScripts', quiet=install_product_quiet)
ZopeTestCase.installProduct('ExternalMethod', quiet=install_product_quiet)
try:
from Testing.ZopeTestCase.layer import onsetup
# On Zope 2.12, installProduct() is a delayed call, so imports that depend on
# products being "initialize"d should only be called "on setup". The
# decorator above delays calls to the decorated function until after Product
# initialization.
# Also, we need Five to wire all our CMF dependencies.
ZopeTestCase.installProduct('Five', quiet=install_product_quiet)
except ImportError:
# On Zope 2.8 the call does not have to be delayed as product installation
# happens immediately
def onsetup(decorated):
return decorated
try:
# Workaround iHotFix patch that doesn't work with
# ZopeTestCase REQUESTs
......@@ -227,7 +242,7 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase):
def shortDescription(self):
description = str(self)
doc = self._TestCase__testMethodDoc
doc = self._testMethodDoc
if doc and doc.split("\n")[0].strip():
description += ', ' + doc.split("\n")[0].strip()
return description
......@@ -269,7 +284,11 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase):
def getPortal(self):
"""Returns the portal object, i.e. the "fixture root".
"""
return self.app[self.getPortalName()]
portal = self.app[self.getPortalName()]
# FIXME: Try not to run this call below so often by moving it somewhere
# where it is called exactly once per test.
portal.setupCurrentSkin(portal.REQUEST)
return portal
getPortalObject = getPortal
......@@ -321,7 +340,7 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase):
self.setUp = self._decorate_setUp(self.setUp)
self.tearDown = self._decorate_tearDown(self.tearDown)
test_name = self._TestCase__testMethodName
test_name = self._testMethodName
test_method = getattr(self, test_name)
setattr(self, test_name, self._decorate_testRun(test_method))
......@@ -334,6 +353,8 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase):
# This is a workaround for the overwriting problem in Testing/__init__.py
# in Zope. So this overwrites them again to revert the changes made by
# Testing.
# XXX: Leo: Is this still true? We need to reevaluate how we get
# information from our environment.
try:
import App.config
except ImportError:
......@@ -773,6 +794,10 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase):
transaction.commit()
self.portal = portal
# Make sure skins are correctly set-up (it's not implicitly set up
# by Acquisition on Zope 2.12 as it is on 2.8)
portal.setupCurrentSkin(portal.REQUEST)
if len(setup_done) == 1: # make sure it is run only once
try:
from Products import DeadlockDebugger
......@@ -1086,6 +1111,7 @@ def dummy_tearDown(self):
'''
self._clear(1)
@onsetup
def optimize():
'''Significantly reduces portal creation time.'''
def __init__(self, text):
......@@ -1125,7 +1151,7 @@ def optimize():
optimize()
@onsetup
def fortify():
'''Add some extra checks that we don't have at runtime, not to slow down the
system.
......
......@@ -121,17 +121,25 @@ def initializeInstanceHome(tests_framework_home,
shutil.copy(src, dst)
else:
os.symlink(src, dst)
# add some paths where we can find copyzopeskel
sys.path.append(os.path.join(zope_home, "bin"))
sys.path.append(os.path.join(zope_home, "utilities"))
import copyzopeskel
kw = {
"PYTHON":sys.executable,
"INSTANCE_HOME": instance_home,
"SOFTWARE_HOME": software_home,
"ZOPE_HOME": zope_home,
}
skelsrc = os.path.abspath(os.path.join(os.path.dirname(__file__), "skel"))
try:
# attempt to import copyzopeskel from its new home on Zope 2.12
from Zope2.utilities import copyzopeskel
# and use the 2.12 version of our skeleton
skeldir = 'skel2.12'
kw['ZOPE_SCRIPTS'] = os.environ['ZOPE_SCRIPTS']
except ImportError:
# add some paths where we can find copyzopeskel
sys.path.append(os.path.join(zope_home, "bin"))
sys.path.append(os.path.join(zope_home, "utilities"))
import copyzopeskel
kw['ZOPE_HOME'] = zope_home
skeldir = 'skel'
skelsrc = os.path.abspath(os.path.join(os.path.dirname(__file__), skeldir))
copyzopeskel.copyskel(skelsrc, instance_home, None, None, **kw)
# site specific variables
......@@ -310,6 +318,9 @@ def runUnitTestList(test_list, verbosity=1, debug=0):
else:
products_home = os.path.join(instance_home, 'Products')
# The following un-monkey-patch is only required for Zope 2.8.
# On Zope 2.12, import_products() is called by ERP5TestCase before it is
# patched by the layer.setUp() call.
import OFS.Application
import_products = OFS.Application.import_products
from Testing import ZopeTestCase # This will import custom_zodb.py
......@@ -326,7 +337,13 @@ def runUnitTestList(test_list, verbosity=1, debug=0):
section = SectionValue({'dateformat': '%Y-%m-%d %H:%M:%S',
'format': '%(asctime)s %(levelname)s %(name)s %(message)s',
'level': logging.INFO,
'path': os.environ['EVENT_LOG_FILE']},
'path': os.environ['EVENT_LOG_FILE'],
'max_size': None,
'old_files': None,
'when': None,
'interval': None,
'formatter': None,
},
None, None)
section.handlers = [FileHandlerFactory(section)]
eventlog = EventLogFactory(section)
......@@ -336,8 +353,6 @@ def runUnitTestList(test_list, verbosity=1, debug=0):
except ImportError:
pass
TestRunner = backportUnittest.TextTestRunner
# allow unit tests of our Products or business templates to be reached.
from glob import glob
product_test_list = glob(os.path.join(products_home, '*', 'tests'))
......@@ -366,6 +381,9 @@ def runUnitTestList(test_list, verbosity=1, debug=0):
save = int(os.environ.get('erp5_save_data_fs', 0))
dummy_test = save and (int(os.environ.get('update_business_templates', 0))
or not int(os.environ.get('erp5_load_data_fs', 0)))
TestRunner = backportUnittest.TextTestRunner
if dummy_test:
# Skip all tests in save mode and monkeypatch PortalTestCase.setUp
# to skip beforeSetUp and afterSetUp. Also patch unittest.makeSuite,
......@@ -382,7 +400,7 @@ def runUnitTestList(test_list, verbosity=1, debug=0):
# Hack the profiler to run only specified test methods, and wrap results when
# running in debug mode.
if debug:
class DebugTextTestRunner(backportUnittest.TextTestRunner):
class DebugTextTestRunner(TestRunner):
def _makeResult(self):
result = super(DebugTextTestRunner, self)._makeResult()
return DebugTestResult(result)
......@@ -396,6 +414,18 @@ def runUnitTestList(test_list, verbosity=1, debug=0):
# change current directory to the test home, to create zLOG.log in this dir.
os.chdir(tests_home)
try:
from Testing.ZopeTestCase import layer
except ImportError:
# Zope 2.8, no need to set-up the ZopeLite layer
pass
else:
# Since we're not using the zope.testing testrunner, we need to set up
# the layer ourselves
# FIXME: We should start using Zope layers. Our setup will probably
# be faster and we could drop most of this code we currently maintain
# ourselves
layer.ZopeLite.setUp()
result = TestRunner(verbosity=verbosity).run(suite)
if save:
......@@ -508,8 +538,13 @@ def main():
result = runUnitTestList(test_list=test_list,
verbosity=verbosity,
debug=debug)
from Testing.ZopeTestCase import profiler
profiler.print_stats()
try:
from Testing.ZopeTestCase import profiler
except ImportError:
if os.environ.get('PROFILE_TESTS') == '1':
print "Profiler support is not available from ZopeTestCase in Zope 2.12"
else:
profiler.print_stats()
sys.exit(len(result.failures) + len(result.errors))
if __name__ == '__main__':
......
@set INSTANCE_HOME=<<INSTANCE_HOME>>
@set CONFIG_FILE=%INSTANCE_HOME%\etc\zope.conf
@set ZOPE_RUN=<<ZOPE_SCRIPTS>>\runzope
@set erp5_load_data_fs=1
"%ZOPE_RUN%" -C "%CONFIG_FILE%" %1 %2 %3 %4 %5 %6 %7
#! /bin/sh
INSTANCE_HOME="<<INSTANCE_HOME>>"
CONFIG_FILE="<<INSTANCE_HOME>>/etc/zope.conf"
ZOPE_RUN="<<ZOPE_SCRIPTS>>/runzope"
export INSTANCE_HOME
export erp5_load_data_fs="1"
exec "$ZOPE_RUN" -C "$CONFIG_FILE" "$@"
@set PYTHON=<<PYTHON>>
@set INSTANCE_HOME=<<INSTANCE_HOME>>
@set CONFIG_FILE=%INSTANCE_HOME%\etc\zope.conf
@set ZDCTL=<<ZOPE_SCRIPTS>>\zopectl
@set export erp5_load_data_fs="1"
"%ZDCTL%" -C "%CONFIG_FILE%" %1 %2 %3 %4 %5 %6 %7
#! /bin/sh
PYTHON="<<PYTHON>>"
INSTANCE_HOME="<<INSTANCE_HOME>>"
CONFIG_FILE="<<INSTANCE_HOME>>/etc/zope.conf"
ZDCTL="<<ZOPE_SCRIPTS>>/zopectl"
export INSTANCE_HOME
export PYTHON
export erp5_load_data_fs="1"
exec "$ZDCTL" -C "$CONFIG_FILE" "$@"
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:meta="http://namespaces.zope.org/meta"
xmlns:five="http://namespaces.zope.org/five">
<include package="Products.Five" />
<meta:redefinePermission from="zope2.Public" to="zope.Public" />
<!-- Load the meta -->
<include files="package-includes/*-meta.zcml" />
<five:loadProducts file="meta.zcml"/>
<!-- Load the configuration -->
<include files="package-includes/*-configure.zcml" />
<five:loadProducts />
<!-- Load the configuration overrides-->
<includeOverrides files="package-includes/*-overrides.zcml" />
<five:loadProductsOverrides />
<securityPolicy
component="Products.Five.security.FiveSecurityPolicy" />
</configure>
###############################################################################
# Welcome to Zope 2.
###############################################################################
#
# This is the Zope configuration file. The Zope configuration file
# shows what the default configuration directives are, and show
# examples for each directive. To declare a directive, make sure that
# you add it to a line that does not begin with '#'. Note that comments
# are only allowed at the beginning of a line: you may not add comments
# after directive text on the same line.
#
# Note for Developers
# ===================
#
# This file is *not* auto-generated. If you create a new directive you
# very likely want to include an example of how to use the new
# directive in this file.
#
# You shouldn't modify 'zope.conf.in' to change
# configuration. Instead, you should make a copy into 'zope.conf' and
# modify that to avoid checking in changes to this file by mistake.
# ZConfig "defines" used for later textual substitution
%define INSTANCE <<INSTANCE_HOME>>
# Directive: instancehome
#
# Description:
# The path to the data files, local product files, import directory,
# and Extensions directory used by Zope.
#
# Required (no default)
#
# Example:
#
# instancehome /home/chrism/projects/sessions
instancehome $INSTANCE
# Directive: clienthome
#
# Description:
# The directory in which a running Zope's process identifier files are
# placed.
#
# Default: $INSTANCE/var
#
# Example:
#
# clienthome /home/chrism/projects/sessions/var
# Directive: path
#
# Description:
# Name of a directory which should be inserted into the
# the beginning of Python's module search path. This directive
# may be specified as many times as needed to insert additional
# directories. The set of directories specified is inserted into the
# beginning of the module search path in the order which they are specified
# here. Note that the processing of this directive may happen too late
# under some circumstances; it is recommended that you use the PYTHONPATH
# environment variable if using this directive doesn't work for you.
#
# Default: $INSTANCE/lib/python
#
# Example:
#
# path $INSTANCE/mypymodules
# Directive: products
#
# Description:
# Name of a directory that contains additional Product packages. This
# directive may be used as many times as needed to add additional
# collections of products. Each directory identified will be
# added to the __path__ of the Products package. All Products are
# initialized in ascending alphabetical order by product name. If
# two products with the same name exist in two Products directories,
# the order in which the packages appear here defines the load
# order. The master Products directory exists in Zope's software home,
# and cannot be removed from the products path (and should not be added
# to it here).
#
# Default: $INSTANCE/Products
#
# Example:
#
# products /home/chrism/projects/myproducts
# Directive: environment
#
# Description:
# A section which can be used to define arbitrary key-value pairs
# for use as environment variables during Zope's run cycle. It
# is not recommended to set system-related environment variables such as
# PYTHONPATH within this section.
#
# Default: unset
#
# Example:
#
# <environment>
# MY_PRODUCT_ENVVAR foobar
# </environment>
# Directive: debug-mode
#
# Description:
# A switch which controls several aspects of Zope operation useful for
# developing under Zope. When debug mode is on:
#
# - The process will not detach from the controlling terminal
#
# - Errors in product initialization will cause startup to fail
# (instead of writing error messages to the event log file).
#
# - Filesystem-based scripts such as skins, PageTemplateFiles, and
# DTMLFiles can be edited while the server is running and the server
# will detect these changes in real time. When this switch is
# off, you must restart the server to see the changes.
#
# Setting this to 'off' when Zope is in a production environment is
# encouraged, as it speeds execution (sometimes dramatically).
#
# Default: off
#
# Example:
#
# debug-mode on
# Directive: effective-user
#
# Description:
# If you intend to run Zope as the "root" user, you must supply this
# directive with an effective username or userid number to which Zope
# will 'suid' after the server ports are bound. This directive only
# has effect under UNIX and if Zope is started as the root user.
#
# Default: unset
#
# Example:
#
# effective-user chrism
# Directive: enable-product-installation
#
# Description:
# If this directive is turned on, Zope performs 'product installation'
# (the registration of Python modules in various Products directories)
# at startup. Turning this off can speed Zope/ZEO startup time,
# but it can also cause your Control_Panel Product list to become
# desynchronized with the contents of your Products
# directories. NOTE: Zope *must* be started at least once with
# this directive set to "on" or you will receive an error. If using ZEO,
# at least one ZEO client must be run with this directive set to "on"
# once, the others can have it turned off.
# NOTE: If your main storage is mounted read-only,
# you must set this directive to "off".
#
# Default: on
#
# Example:
#
# enable-product-installation off
# Directive: locale
#
# Description:
# Enable locale (internationalization) support by supplying a locale
# name to be used. See your operating system documentation for locale
# information specific to your system. If your Python module does not
# support the locale module, or if the requested locale is not
# supported by your system, an error will be raised and Zope will not
# start.
#
# Default: unset
#
# Example:
#
# locale fr_FR
# Directive: datetime-format
#
# Description:
# Set this variable either to "us" or "international" to force the
# DateTime module to parse date strings either with
# month-before-days-before-year ("us") or
# days-before-month-before-year ("international"). The default
# behaviour of DateTime (when this setting is left unset) is to
# parse dates as US dates.
#
# Default: us
#
# Example:
#
# datetime-format international
# Directive: zserver-threads
#
# Description:
# Specify the number of threads that Zope's ZServer web server will use
# to service requests. The default is 4.
#
# Default: 4
#
# Example:
#
# zserver-threads 10
# Directive: python-check-interval
#
# Description:
# Specify an integer representing the Python interpreter "check
# interval" This interval determines how often the interpreter checks
# for periodic things such as thread switches and signal handlers. The
# Zope default is 500, but you may want to experiment with other values
# in order to attempt to increae performance in your particular
# environment.
#
# Default: 500
#
# Example:
#
# python-check-interval 1000
# Directive: zserver-read-only-mode
#
# Description:
# If this directive is set to 'on', it will cause Zope to inhibit the
# creation of log files and pid files. Access and event log files will
# be presented on standard output. Setting this directive 'on' causes
# pcgi, fastcgi, and daemon-related directives to have no effect.
#
# Default: off
#
# Example:
#
# zserver-read-only-mode on
# Directive: pid-filename
#
# Description:
# The path to the file in which the Zope process id(s) will be written.
# This defaults to client-home/Z2.pid.
#
# Default: CLIENT_HOME/Z2.pid
#
# Example:
#
# pid-filename /home/chrism/projects/sessions/var/Z2.pid
# Directive: lock-filename
#
# Description:
# The path to a "lock file" which will be locked by Zope while it's
# running. This file is used by zopectl.py to determine if Zope is
# currently running. This defaults to CLIENT_HOME/Z2.lock.
#
# Default: CLIENT_HOME/Z2.lock
#
# Example:
#
# lock-filename /home/chrism/projects/sessions/var/Z2.lock
# Directive: mime-types
#
# Description:
# Tells Zope about additional mime.types files that should be
# loaded. The files have the same format as the mime.types file
# distributed with Apache. The "mime-types" setting may be given
# more than once in the configuration file.
#
# Example:
#
# mime-types $INSTANCE/etc/mime.types
# Directive: structured-text-header-level
#
# Description:
# Set the default starting HTML header level for structured text
# documents. The default is 3, which implies that top-level headers
# will be created with an <H3> tag.
#
# Default: 3
#
# Example:
#
# structured-text-header-level 1
# Directive: rest-input-encoding
#
# Description:
# Specifies the input encoding of re-StructuredText documents
# (e.g. 'utf-8', 'iso-8859-15' or any other valid encoding recognized
# by Python). The default is your Python's default encoding.
#
# Default: unset (uses system default)
#
# Example:
#
# rest-input-encoding iso-8859-15
# Directive: rest-output-encoding
#
# Description:
# Specifies the output encoding of re-StructuredText documents
# (e.g. 'utf-8', 'iso-8859-15' or any other valid encoding recognized
# by Python). The default is your Python's default encoding.
#
# Default: unset (uses system default)
#
# Example:
#
# rest-output-encoding iso-8859-15
# Directive: rest-header-level
#
# Description:
# Set the default starting HTML header level for restructured text
# documents. The default is 3, which implies that top-level headers
# will be created with an <H3> tag.
#
# Default: 3
#
# Example:
#
# rest-header-level 2
# Directive: rest-language-code
#
# Description:
# Language code used for some internal translations inside of the docutils
# package and for DTD bibliographic elements mapping. See
# lib/python/docutils/languages/ for a list of supported language codes.
#
# Default: en
#
# Example:
#
# rest-language-code de
# Directive: cgi-environment
#
# Description:
# A section which allows a user to define arbitrary key-value pairs for
# use as the initial CGI environment variables. This is useful
# when you want to proxy requests from another web server to Zserver,
# and would like Zserver's CGI environment to reflect the CGI
# environment of the other web server.
#
# Default: unset
#
# Example:
#
# <cgi-environment>
# HTTPS_SERVER Foobar Server 1.0
# HTTPS_PORT 443
# </cgi-environment>
# Directive: dns-server
#
# Description:
# Specify the IP address of your DNS server in order to cause resolved
# hostnames to be written to Zope's access log. By default, Zope will
# not resolve hostnames unless this is set.
#
# Default: unset
#
# Example:
#
# dns-server 127.0.0.1
# Directive: ip-address
#
# Description:
# The default IP address on which Zope's various server protocol
# implementations will listen for requests. If this is unset, Zope
# will listen on all IP addresses supported by the machine. This
# directive can be overridden on a per-server basis in the servers
# section.
#
# Default: unset
#
# Example:
#
# ip-address 127.0.0.1
# Directive: http-realm
#
# Description:
# The HTTP "Realm" header value sent by this Zope instance. This value
# often shows up in basic authentication dialogs.
#
# Default: Zope
#
# Example:
#
# http-realm Slipknot
# Directive: cgi-maxlen
#
# Description:
# Set this value to limit the amount of form data being processed
# by Zope to prevent DoS attacks.
#
# Default: 0 (= no restrictions)
#
# Example:
#
# cgi-maxlen 10000
# Directive: http-header-max-length
#
# Description:
# Maximum number of bytes allowed within a HTTP request header. The request
# is discarded and considered as a DoS attack if the header size exceeds
# this limit.
#
# Default: 8192
#
# Example:
#
# http-header-max-length 16384
# Directive: enable-ms-author-via
#
# Description:
# Set this directive to 'true' to enable the "MS-Author-Via" header
# in response to an OPTIONS WebDAV request. Early versions of
# Microsoft Web Folders and Microsoft Office require this header to
# be present to be able to connect to Zope via WebDAV.
#
# This is disabled by default since it makes a lot of standards-compliant
# things unhappy AND it tricks Microsoft Office into trying to edit Office
# files stored in Zope via WebDAV even when the user isn't allowed to edit
# them and is only trying to download them.
#
# Check this collector entry for more information:
# http://www.zope.org/Collectors/Zope/1441
#
# Recent versions of Microsoft Web Folders, updated after January
# 2005, do not require this header anymore, and instead require a
# "Public" header to be present in reply to the OPTIONS WebDAV
# request.
# (http://www.redmountainsw.com/wordpress/archives/webfolders-zope)
#
# To get a recent Microsoft Web Folders implementation, refer to
# Microsoft KB Article 907306.
# (Software Update for Web Folders: May 18, 2007).
#
# Default: off
#
# Example:
#
# enable-ms-author-via on
# Directive: enable-ms-public-header
#
# Description:
# Set this directive to 'on' to enable sending the "Public" header
# in response to an WebDAV OPTIONS request.
#
# Though recent WebDAV drafts mention this header, the original
# WebDAV RFC did not mention it as part of the standard. Very few
# web servers out there include this header in their replies, most
# notably IIS and Netscape Enterprise 3.6.
#
# Since many best practices documents out in the web mention
# turning off this header with the subject of "Mask Your Web Server
# For Enhanced Security", this setting is off by
# default. Presumably malicious people might take the presence of
# this header as indication of an IIS Web Server and try to attack
# your site, so be careful when turning it on.
#
# Recent versions of Microsoft Web Folders, updated after January
# 2005, *do* require this header to be present in reply to the
# OPTIONS WebDAV request.
# (http://www.redmountainsw.com/wordpress/archives/webfolders-zope)
#
# To get a recent Microsoft Web Folders implementation, refer to
# Microsoft KB Article 907306.
# (Software Update for Web Folders: May 18, 2007).
#
# Default: off
#
# Example:
#
# enable-ms-public-header on
# Directive: automatically-quote-dtml-request-data
#
# Description:
# Set this directive to 'off' in order to disable the autoquoting of
# implicitly retrieved REQUEST data by DTML code which contains a '<'
# when used in <dtml-var> construction. When this directive is 'on',
# all data implicitly retrieved from the REQUEST in DTML (as opposed to
# addressing REQUEST.somevarname directly) that contains a '<' will be
# HTML-quoted when interpolated via a <dtml-var> or &dtml- construct. This
# mitigates the possibility that DTML programmers will leave their
# sites open to a "client-side trojan" attack.
#
# Default: on
#
# Example:
#
# automatically-quote-dtml-request-data on
# Directive: trusted-proxy
#
# Description:
# Define one or more 'trusted-proxies' directives, each of which is a
# hostname or an IP address. The set of definitions comprises a list
# of front-end proxies that are trusted to supply an accurate
# X-Forwarded-For header to Zope. If a connection comes from
# a trusted proxy, Zope will trust any X-Forwarded header to contain
# the user's real IP address for the purposes of address-based
# authentication restriction.
#
# Default: unset
#
# Example:
#
# trusted-proxy www.example.com
# trusted-proxy 192.168.1.1
# Directive: publisher-profile-file
#
# Description:
# Names a file on the filesystem which causes Zope's Python
# profiling capabilities to be enabled. For more information, see
# the Debug Information - > Profiling tab of Zope's Control_Panel
# via the Zope Management Interface. IMPORTANT: setting this
# filename will cause Zope code to be executed much more slowly
# than normal. This should not be enabled in production.
#
# Default: unset
#
# Example:
#
# publisher-profile-file $INSTANCE/var/profile.dat
# Directive: security-policy-implementation
#
# Description:
# The default Zope security machinery is implemented in C. Change
# this to "python" to use the Python version of the Zope security
# machinery. This setting may impact performance but is useful
# for debugging purposes. See also the "verbose-security" option
# below.
#
# Default: C
#
# Example:
#
# security-policy-implementation python
# Directive: skip-authentication-checking
#
# Description:
# Set this directive to 'on' to cause Zope to skip checks related
# to authentication, for servers which serve only anonymous content.
# Only works if security-policy-implementation is 'C'.
#
# Default: off
#
# Example:
#
# skip-authentication-checking on
# Directive: skip-ownership-checking
#
# Description:
# Set this directive to 'on' to cause Zope to ignore ownership checking
# when attempting to execute "through the web" code. By default, this
# directive is on in order to prevent 'trojan horse' security problems
# whereby a user with less privilege can cause a user with more
# privilege to execute dangerous code.
#
# Default: off
#
# Example:
#
# skip-ownership-checking on
# Directive: verbose-security
#
# Description:
# By default, Zope reports authorization failures in a terse manner in
# order to avoid revealing unnecessary information. This option
# modifies the Zope security policy to report more information about
# the reason for authorization failures. It's designed for debugging.
# If you enable this option, you must also set the
# 'security-policy-implementation' to 'python'.
#
# Default: off
#
# Example:
#
# security-policy-implementation python
# verbose-security on
# Directive: maximum-number-of-session-objects
#
# Description:
# An integer value representing the number of items to use as a
# "maximum number of subobjects" value of the
# '/temp_folder/session_data' transient object container.
#
# Default: 1000
#
# Example:
#
# maximum-number-of-session-objects 10000
# Directive: session-add-notify-script-path
#
# Description:
# An optional fill Zope path name of a callable object to be set as the
# "script to call on object addition" of the sessioN_data transient
# object container created in the /temp_folder folder at startup.
#
# Default: unset
#
# Example:
#
# session-add-notify-script-path /scripts/add_notifier
# Directive: session-delete-notify-script-path
#
# Description:
# An optional fill Zope path name of a callable object to be set as the
# "script to call on object deletion" of the sessioN_data transient
# object container created in the /temp_folder folder at startup.
#
# Default: unset
#
# Example:
#
# session-delete-notify-script-path /scripts/del_notifier
# Directive: session-timeout-minutes
#
# Description:
# An integer value representing the number of minutes to be used as the
# "data object timeout" of the '/temp_folder/session_data' transient
# object container.
#
# Default: 20
#
# Example:
#
# session-timeout-minutes 30
# Directive: session-resolution-seconds
#
# Description:
# An integer value representing the number of seconds to be used as the
# "timeout resolution" of the '/temp_folder/session_data' transient
# object container.
#
# Default: 20
#
# Example:
#
# session-resolution-seconds 60
# Directive: suppress-all-access-rules
#
# Description:
# If this directive is set to on, no access rules in your Zope site
# will be executed. This is useful if you "lock yourself out" of a
# particular part of your site by setting an improper access rule.
#
# Default: off
#
# Example:
#
# suppress-all-access-rules on
# Directive: suppress-all-site-roots
#
# Description:
# If this directive is set to on, no site roots in your Zope site will
# be effective. This is useful if you "lock yourself out" of a
# particular part of your site by setting an improper site root.
#
# Default: off
#
# Example:
#
# suppress-all-site-roots on
# Directive: database-quota-size
#
# Description:
# Set this directive to an integer in bytes in order to place a hard
# limit on the size which the default FileStorage-backed Zope database
# can grow. Additions to the database will not be permitted once this
# filesize is exceeded.
#
# Default: unset
#
# Example:
#
# database-quota-size 1000000
# Directive: zeo-client-name
#
# Description:
# If you want a persistent ZEO client cache which retains cache
# contents across ClientStorage restarts, you need to define a
# zeo-client-name. If you use ZEO and you don't set a
# zeo-client-name, the client cache is stored in temporary files
# which are removed when the ClientStorage shuts down. The value
# of zeo-client-name is used to uniquely identify the local cache
# files created if this Zope is a ZEO client.
#
# Default: unset
#
# Example:
#
# zeo-client-name zeo1
# Directives: logger
#
# Description:
# This area should define one or more "logger" sections of the
# names "access", "event", and "trace". The "access" logger logs
# Zope server access. The "event" logger logs Zope event
# information. The "trace" logger logs detailed server request
# information (for debugging purposes only). Each logger section
# may contain a "level" name/value pair which indicates the level
# of logging detail to capture for this logger. The default level
# is INFO. Level may be any of "CRITICAL", 'ERROR", WARN", "INFO",
# "DEBUG", and "ALL". Each logger section may additionally contain
# one or more "handler" sections which indicates a types of log
# "handlers" (file, syslog, NT event log, etc) to be used for the
# logger being defined. There are 5 types of handlers: logfile,
# syslog, win32-eventlog, http-handler, email-notifier. Each
# handler type has its own set of allowable subkeys which define
# aspects of the handler. All handler sections also allow for the
# specification of a "format" (the log message format string), a
# "dateformat" (the log message format for date strings), and a
# "level", which has the same semantics of the overall logger
# level but overrides the logger's level for the handler it's
# defined upon. XXXX much more detail necessary here
#
# Default:
#
# The access log will log to the file <instancehome>/log/Z2.log at
# level INFO, the event log will log to the file
# <instancehome>/log/event.log at level INFO, and the trace log
# will not be written anywhere.
<eventlog>
level info
<logfile>
path $INSTANCE/log/event.log
level info
</logfile>
</eventlog>
<logger access>
level WARN
<logfile>
path $INSTANCE/log/Z2.log
format %(message)s
</logfile>
</logger>
# <logger trace>
# level WARN
# <logfile>
# path $INSTANCE/log/trace.log
# format %(message)s
# </logfile>
# </logger>
# Directive: conflict-error-log-level
#
# Description:
# Specifies at which level conflict errors are logged. Conflict
# errors, when occuring in small numbers, are a normal part of the
# Zope optimistic transaction conflict resolution algorithms. They
# are retried automatically a few times, and are therefore usually
# not visible by the user. You can specify 'notset' if you don't
# want them logged, or use any other logger level (see above).
#
# Default: info
#
# Example:
#
# conflict-error-log-level blather
# Directive: warnfilter
#
# Description:
# A section that allows you to define a warning filter.
# The following keys are valid within a warnfilter section:
#
# action: one of the following strings:
#
# "error" turn matching warnings into exceptions
# "ignore" never print matching warnings
# "always" always print matching warnings
# "default" print the first occurrence of matching warnings
# for each location where the warning is issued
# "module" print the first occurrence of matching warnings
# for each module where the warning is issued
# "once" print only the first occurrence of matching
# warnings, regardless of location
#
# message: a string containing a regular expression that the
# warning message must match (the match is compiled to
# always be case-insensitive)
#
# category: a Python dotted-path classname (must be a subclass of
# Warning) of which the warning category must be a subclass in
# order to match
#
# module: a string containing a regular expression that the
# module name must match (the match is compiled to be
# case-sensitive)
#
# lineno: an integer that the line number where the warning
# occurred must match, or 0 to match all line numbers
#
# All keys within a warnfilter section are optional. More than
# one warnfilter section may be specified.
#
# Default: unset
#
# Example:
#
# <warnfilter>
# action ignore
# category exceptions.DeprecationWarning
# </warnfilter>
# Directive: max-listen-sockets
#
# Description:
# The maximum number of sockets that ZServer will attempt to open
# in order to service incoming connections.
#
# Default: 1000
#
# Example:
#
# max-listen-sockets 500
# Directives: port-base
#
# Description:
# Offset applied to the port numbers used for ZServer
# configurations. For example, if the http-server port is 8080 and
# the port-base is 1000, the HTTP server will listen on port 9080.
# This makes it easy to change the complete set of ports used by a
# Zope server process
#
# Default:
#
# 0
#
# Example:
#
# port-base 1000
# Directive: large-file-threshold
#
# Description:
# Requests bigger than this size get saved into a temporary file
# instead of being read completely into memory.
#
# Default: 512K
#
# Example:
#
# large-file-threshold 1Mb
# Directive: default-zpublisher-encoding
#
# Description:
# This controls what character set is used to encode unicode
# data that reaches ZPublisher without any other specified encoding.
#
# Default: iso-8859-15
#
# Example:
#
# default-zpublisher-encoding utf-8
# Directives: servers
#
# Description:
# A set of sections which allow the specification of Zope's various
# ZServer servers. 8 different server types may be defined:
# http-server, ftp-server, webdav-source-server, persistent-cgi,
# fast-cgi, monitor-server, icp-server, and clock-server. If no servers
# are defined, the default servers are used.
#
# Ports may be specified using the 'address' directive either in simple
# form (80) or in complex form including hostname 127.0.0.1:80. If the
# hostname is "left off", the default-ip-address is used as the hostname.
#
# Port numbers are offset by the setting of port-base.
#
# To run the monitor-server an emergency user must be defined
# (through an 'access' file).
#
# Default:
#
# An HTTP server starts on port 8080.
<http-server>
# valid keys are "address" and "force-connection-close"
address 8080
# force-connection-close on
#
# You can also use the WSGI interface between ZServer and ZPublisher:
# use-wsgi on
#
# To defer the opening of the HTTP socket until the end of the
# startup phase:
# fast-listen off
</http-server>
# Examples:
#
# <ftp-server>
# # valid key is "address"
# address 8021
# </ftp-server>
#
# <webdav-source-server>
# # valid keys are "address" and "force-connection-close"
# address 1980
# force-connection-close off
# </webdav-source-server>
#
# <persistent-cgi>
# # valid key is "path"
# path somefile
# </persistent-cgi>
#
# <fast-cgi>
# # valid key is "address"; the address may be hostname:port, port,
# # or a path for a Unix-domain socket
# address somefile
# </fast-cgi>
#
# <monitor-server>
# # valid keys are "address"
# address 8099
# </monitor-server>
#
# <icp-server>
# # valid key is "address"
# address 888
# </icp-server>
#
# <clock-server>
# # starts a clock which calls /foo/bar every 30 seconds
# method /foo/bar
# period 30
# user admin
# password 123
# </clock-server>
# Database (zodb_db) section
#
# Description:
# A database section allows the definition of custom database and
# storage types. More than one zodb_db section can be defined.
#
# Default: unset.
# IMPORTANT: At least one database with a mount-point of "/"
# must be specified for Zope to start properly.
<zodb_db main>
# Main FileStorage database
<filestorage>
# See .../ZODB/component.xml for directives (sectiontype
# "filestorage").
path $INSTANCE/Data.fs
</filestorage>
mount-point /
</zodb_db>
<zodb_db temporary>
# Temporary storage database (for sessions)
<temporarystorage>
name temporary storage for sessioning
</temporarystorage>
mount-point /temp_folder
container-class Products.TemporaryFolder.TemporaryContainer
</zodb_db>
# Other storage examples
#
# ZEO client storage:
#
# <zodb_db main>
# # The full mount-point syntax is:
# #
# # mount-point <localpath>[:<remotepath>]
# #
# # localpath - the path where the storage is mounted in this instance
# # remotepath - is the path to the object in the storage where it is mounted
# # from. This defaults to whatever is supplied for localpath.
# mount-point /
# # ZODB cache, in number of objects
# cache-size 5000
# <zeoclient>
# # See .../ZODB/component.xml for directives (sectiontype
# # "zeoclient").
# server localhost:8100
# storage 1
# name zeostorage
# var $INSTANCE/var
# # ZEO client cache, in bytes
# cache-size 20MB
# # Uncomment to have a persistent disk cache
# #client zeo1
# </zeoclient>
# </zodb_db>
# Product configuration (product-config) section(s)
#
# Description:
# Add-on products may need to allow the user to specify policy /
# configuration. Such policies may be expressed as a set of
# name-value pairs, grouped into a named section (there may
# be many such sections, typically one per product).
# These sections will be captured in an attribute, 'product_config'
# of the top-level config object, under the key corresponding to
# the section name. E.g., the sample section below would be
# parsed into a dict, {'bar': 'baz'}, available as
# config.product_config['foo']
#
# Products may also register their own section types, extending
#
#
# Example:
#
# 1. Simple "bag of strings" section:
#
# <product-config foo>
# bar baz
# </product-config>
#
# 2. Custom section type
#
# Products/Foo/component.xml:
#
# <component>
# <description>
# Some product-specific hackery.
# </description>
# <sectiontype name="myproduct" implements="zope.product.base">
# <description>
# Product-specific configuration.
# </description>
# <key name="foo" />
# </sectiontype>
# </component>
#
# In zope.conf:
#
# %import Products.Foo
#
# <myproduct bar>
# foo qux
# </myproduct>
# The clock server replaces the old timeserver package, but still calls the
# method installed by the TimeService product.
<clock-server>
method /Control_Panel/timer_service/process_timer?interval:int=5
period 5
</clock-server>
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