From 4b44364c004fde43b25311f2cdad6f1d0cf9843b Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Fri, 9 Feb 2007 05:35:46 +0000 Subject: [PATCH] * support --save and --load option. * in --save mode, all test_* methods are skipped. * in --load mode, use a DemoStorage based on a Data.fs made by --save mode. * install bin/zopectl, bin/runzope and etc/zope.conf to the unit_test directory to make possible to run real zope server on it. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12589 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/tests/ERP5TypeTestCase.py | 74 +- product/ERP5Type/tests/custom_zodb.py | 22 +- product/ERP5Type/tests/runUnitTest.py | 36 +- product/ERP5Type/tests/skel/bin/runzope.in | 15 + product/ERP5Type/tests/skel/bin/zopectl.in | 15 + product/ERP5Type/tests/skel/etc/zope.conf.in | 950 +++++++++++++++++++ 6 files changed, 1095 insertions(+), 17 deletions(-) create mode 100755 product/ERP5Type/tests/skel/bin/runzope.in create mode 100755 product/ERP5Type/tests/skel/bin/zopectl.in create mode 100755 product/ERP5Type/tests/skel/etc/zope.conf.in diff --git a/product/ERP5Type/tests/ERP5TypeTestCase.py b/product/ERP5Type/tests/ERP5TypeTestCase.py index 3a80127406..27c981bfea 100644 --- a/product/ERP5Type/tests/ERP5TypeTestCase.py +++ b/product/ERP5Type/tests/ERP5TypeTestCase.py @@ -26,9 +26,15 @@ Globals.get_request = get_request from Testing import ZopeTestCase from Testing.ZopeTestCase.PortalTestCase import PortalTestCase, user_name from Products.CMFCore.utils import getToolByName -from Products.ERP5Type.Utils import getLocalPropertySheetList, removeLocalPropertySheet -from Products.ERP5Type.Utils import getLocalDocumentList, removeLocalDocument -from Products.ERP5Type.Utils import getLocalConstraintList, removeLocalConstraint +from Products.ERP5Type.Utils import getLocalPropertySheetList, \ + removeLocalPropertySheet, \ + importLocalPropertySheet +from Products.ERP5Type.Utils import getLocalDocumentList, \ + removeLocalDocument, \ + importLocalDocument +from Products.ERP5Type.Utils import getLocalConstraintList, \ + removeLocalConstraint, \ + importLocalConstraint from zLOG import LOG, DEBUG try: @@ -37,7 +43,7 @@ except ImportError: pass # Quiet messages when installing products -install_product_quiet = 0 +install_product_quiet = 1 # Quiet messages when installing business templates install_bt5_quiet = 0 @@ -142,6 +148,7 @@ import os from cStringIO import StringIO from urllib import urlretrieve from glob import glob +import pysvn from Products.ERP5.ERP5Site import ERP5Site @@ -176,6 +183,15 @@ def _getConnectionStringDict(): class ERP5TypeTestCase(PortalTestCase): + def dummy_test(self): + ZopeTestCase._print('All tests are skipped with --save option.') + + def getRevision(self): + try: + return pysvn.Client().info('%s/Products/ERP5' % os.environ['INSTANCE_HOME']).revision.number + except: + return None + def getTitle(self): """Returns the title of the test, for test reports. """ @@ -515,18 +531,29 @@ def setupERP5Site( business_template_list=(), get_transaction().commit() portal = app[portal_name] - # Remove all local PropertySheets, Documents - for id_ in getLocalPropertySheetList(): - removeLocalPropertySheet(id_) - for id_ in getLocalDocumentList(): - removeLocalDocument(id_) - for id_ in getLocalConstraintList(): - removeLocalConstraint(id_) + if os.environ.get('erp5_load_data_fs'): + # Import local PropertySheets, Documents + for id_ in getLocalPropertySheetList(): + importLocalPropertySheet(id_) + for id_ in getLocalDocumentList(): + importLocalDocument(id_) + for id_ in getLocalConstraintList(): + importLocalConstraint(id_) + else: + # Remove all local PropertySheets, Documents + for id_ in getLocalPropertySheetList(): + removeLocalPropertySheet(id_) + for id_ in getLocalDocumentList(): + removeLocalDocument(id_) + for id_ in getLocalConstraintList(): + removeLocalConstraint(id_) # Disable reindexing before adding templates # VERY IMPORTANT: Add some business templates for url, id_ in business_template_list: start = time.time() + if id_ in portal.portal_templates.objectIds(): + continue if not quiet: ZopeTestCase._print('Adding %s business template ... ' % id_) portal.portal_templates.download(url, id=id_) @@ -562,6 +589,26 @@ def setupERP5Site( business_template_list=(), from Products.ERP5Type.Base import _aq_reset _aq_reset() + if os.environ.get('erp5_save_data_fs'): + # Quit the test in order to get a clean site + if not quiet: + ZopeTestCase._print('done (%.3fs)\n' % (time.time()-_start,)) + get_transaction().commit() + ZopeTestCase.close(app) + if not quiet: + ZopeTestCase._print('Data.fs created\n') + get_transaction().commit() + ZopeTestCase.close(app) + if not quiet: + ZopeTestCase._print('Dumping MySQL database ... ') + instance_home = os.environ['INSTANCE_HOME'] + os.system('mysqldump -u test test > %s/dump.sql' % instance_home) + if not quiet: + ZopeTestCase._print('Dumping static files ... ') + for dir in ('Constraint', 'Document', 'PropertySheet'): + os.system('rm -rf %s/%s.bak' % (instance_home, dir)) + os.system('cp -ar %s/%s %s/%s.bak' % (instance_home, dir, instance_home, dir)) + # Log out if not quiet: ZopeTestCase._print('Logout ... \n') @@ -585,6 +632,11 @@ def setupERP5Site( business_template_list=(), % title) # run_unit_test depends on this string. raise +from unittest import _makeLoader, TestSuite + +def dummy_makeSuite(testCaseClass, prefix='dummy_test', sortUsing=cmp, suiteClass=TestSuite): + return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromTestCase(testCaseClass) + def optimize(): '''Significantly reduces portal creation time.''' def __init__(self, text): diff --git a/product/ERP5Type/tests/custom_zodb.py b/product/ERP5Type/tests/custom_zodb.py index b44e14b872..adfdccb960 100644 --- a/product/ERP5Type/tests/custom_zodb.py +++ b/product/ERP5Type/tests/custom_zodb.py @@ -3,9 +3,27 @@ import os from ZODB.DemoStorage import DemoStorage from ZODB.FileStorage import FileStorage +instance_home = os.environ.get('INSTANCE_HOME') data_fs_path = os.environ.get('erp5_tests_data_fs_path') -if data_fs_path: +new_data_fs_path = os.path.join(instance_home, 'Data.fs') + +if os.environ.get('erp5_save_data_fs'): + if os.path.exists(new_data_fs_path): + os.remove(new_data_fs_path) + Storage = FileStorage(new_data_fs_path) +elif os.environ.get('erp5_load_data_fs'): + if os.environ.get('erp5_force_data_fs'): + Storage = FileStorage(new_data_fs_path) + else: + Storage = DemoStorage(base=FileStorage(new_data_fs_path), quota=(1<<20)) + print("Restoring MySQL database ... ") + os.system("mysql -u test test < %s/dump.sql" % instance_home) + print("Restoring static files ... ") + for dir in ('Constraint', 'Document', 'PropertySheet'): + if os.path.exists('%s/%s.bak' % (instance_home, dir)): + os.system('rm -rf %s/%s' % (instance_home, dir)) + os.system('cp -ar %s/%s.bak %s/%s' % (instance_home, dir, instance_home, dir)) +elif data_fs_path: Storage = DemoStorage(base=FileStorage(data_fs_path), quota=(1<<20)) else: Storage = DemoStorage(quota=(1<<20)) - diff --git a/product/ERP5Type/tests/runUnitTest.py b/product/ERP5Type/tests/runUnitTest.py index b10bbc39e0..b174f7e1d3 100755 --- a/product/ERP5Type/tests/runUnitTest.py +++ b/product/ERP5Type/tests/runUnitTest.py @@ -20,6 +20,11 @@ Options: --recreate_catalog=0 or 1 recreate the content of the sql catalog. Defaults is to recreate, when using an existing Data.fs + --save add erp5 sites and business templates in Data.fs + and exit without invoking any tests + --load load Data.fs and skip adding erp5 sites and + business templates + --erp5_sql_connection_string=STRING ZSQL Connection string for erp5_sql_connection, by default, it will use "test test" @@ -52,11 +57,11 @@ def initializeInstanceHome(tests_framework_home, instance_home): if not os.path.exists(instance_home): os.mkdir(instance_home) - for d in ('Constraint', 'Document', 'PropertySheet', 'tests', 'var'): + for d in ('Constraint', 'Document', 'PropertySheet', 'bin', 'etc', 'tests', 'var', 'log'): path = os.path.join(instance_home, d) if not os.path.exists(path): os.mkdir(path) - for d in ('Extensions', 'Products', 'bt5'): + for d in ('Extensions', 'Products', 'bt5', 'svn'): src = os.path.join(real_instance_home, d) dst = os.path.join(instance_home, d) if not os.path.exists(dst): @@ -69,13 +74,25 @@ def initializeInstanceHome(tests_framework_home, if os.path.lexists(dst): raise RuntimeError, '%s is a broken symlink' % dst os.symlink(src, dst) + sys.path.append(os.path.join(zope_home, "bin")) + 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")) + copyzopeskel.copyskel(skelsrc, instance_home, None, None, **kw) # site specific variables # handle 64bit architecture if os.path.isdir('/usr/lib64/zope/lib/python'): software_home = '/usr/lib64/zope/lib/python' + zope_home = '/usr/lib64/zope' else: software_home = '/usr/lib/zope/lib/python' + zope_home = '/usr/lib/zope' tests_framework_home = os.path.dirname(os.path.abspath(__file__)) # handle 'system global' instance @@ -152,7 +169,12 @@ def runUnitTestList(test_list) : # this allows to bypass psyco by creating a dummy psyco module # it is then possible to run the debugger by "import pdb; pdb.set_trace()" sys.path.insert(0, tests_framework_home) - + + # override unittest.makeSuite to skip all tests in save mode + if os.environ.get('erp5_save_data_fs'): + from Products.ERP5Type.tests.ERP5TypeTestCase import dummy_makeSuite + unittest.makeSuite = dummy_makeSuite + filtered_tests_class_names = 0 for test in test_list: if ':' in test: @@ -196,6 +218,8 @@ def main(): "cmf_activity_sql_connection_string=", "erp5_sql_deferred_connection_string=", "erp5_catalog_storage=", + "save", + "load", "email_from_address="] ) except getopt.GetoptError, msg: usage(sys.stderr, msg) @@ -232,6 +256,10 @@ def main(): os.environ["erp5_sql_deferred_connection_string"] = arg elif opt == "--email_from_address": os.environ["email_from_address"] = arg + elif opt == "--save": + os.environ["erp5_save_data_fs"] = "1" + elif opt == "--load": + os.environ["erp5_load_data_fs"] = "1" elif opt == "--erp5_catalog_storage": os.environ["erp5_catalog_storage"] = arg @@ -239,7 +267,7 @@ def main(): if not test_list: print "No test to run, exiting immediately." sys.exit(1) - + result = runUnitTestList(test_list=test_list) from Testing.ZopeTestCase import profiler profiler.print_stats() diff --git a/product/ERP5Type/tests/skel/bin/runzope.in b/product/ERP5Type/tests/skel/bin/runzope.in new file mode 100755 index 0000000000..eec2328b3f --- /dev/null +++ b/product/ERP5Type/tests/skel/bin/runzope.in @@ -0,0 +1,15 @@ +#! /bin/sh + +PYTHON="<<PYTHON>>" +ZOPE_HOME="<<ZOPE_HOME>>" +INSTANCE_HOME="<<INSTANCE_HOME>>" +CONFIG_FILE="<<INSTANCE_HOME>>/etc/zope.conf" +SOFTWARE_HOME="<<SOFTWARE_HOME>>" +PYTHONPATH="$SOFTWARE_HOME" +export PYTHONPATH INSTANCE_HOME SOFTWARE_HOME + +export erp5_load_data_fs="1" + +ZOPE_RUN="$SOFTWARE_HOME/Zope/Startup/run.py" + +exec "$PYTHON" "$ZOPE_RUN" -C "$CONFIG_FILE" "$@" diff --git a/product/ERP5Type/tests/skel/bin/zopectl.in b/product/ERP5Type/tests/skel/bin/zopectl.in new file mode 100755 index 0000000000..ddd8b6b66c --- /dev/null +++ b/product/ERP5Type/tests/skel/bin/zopectl.in @@ -0,0 +1,15 @@ +#! /bin/sh + +PYTHON="<<PYTHON>>" +ZOPE_HOME="<<ZOPE_HOME>>" +INSTANCE_HOME="<<INSTANCE_HOME>>" +CONFIG_FILE="<<INSTANCE_HOME>>/etc/zope.conf" +SOFTWARE_HOME="<<SOFTWARE_HOME>>" +PYTHONPATH="$SOFTWARE_HOME" +export PYTHONPATH INSTANCE_HOME SOFTWARE_HOME + +export erp5_load_data_fs="1" + +ZDCTL="$SOFTWARE_HOME/Zope/Startup/zopectl.py" + +exec "$PYTHON" "$ZDCTL" -C "$CONFIG_FILE" "$@" diff --git a/product/ERP5Type/tests/skel/etc/zope.conf.in b/product/ERP5Type/tests/skel/etc/zope.conf.in new file mode 100755 index 0000000000..6151199cfd --- /dev/null +++ b/product/ERP5Type/tests/skel/etc/zope.conf.in @@ -0,0 +1,950 @@ +############################################################################### +# 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. + +# ZConfig "defines" used for later textual substitution + +%define INSTANCE <<INSTANCE_HOME>> +%define ZOPE <<ZOPE_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: on +# +# 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: 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 impacts performance but +# is useful for debugging purposes and required by Products such as +# VerboseSecurity, which need to "monkey-patch" the security +# machinery. +# +# 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: 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: read-only-database +# +# Description: +# This causes the main Zope FileStorage-backed ZODB to be opened in +# read-only mode. +# +# Default: off +# +# Example: +# +# read-only-database on + + +# 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: 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. 7 different server types may be defined: +# http-server, ftp-server, webdav-source-server, persistent-cgi, +# fast-cgi, monitor-server, and icp-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. +# +# To run the monitor-server an emergency user must be defined +# (through an 'access' file). +# +# Port numbers are offset by the setting of port-base. +# +# Default: +# +# An HTTP server starts on port 8080, an FTP server starts on port +# 8021. + +<http-server> + # valid keys are "address" and "force-connection-close" + address 8080 + # force-connection-close on +</http-server> + +<ftp-server> + # valid key is "address" + address 8021 +</ftp-server> + +# Examples: +# +# <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 99 +# </monitor-server> +# +# <icp-server> +# # valid key is "address" +# address 888 +# </icp-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> + 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> +# mount-point / +# # ZODB cache, in number of objects +# cache-size 5000 +# <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> + +# The Timer Server replace the ERP5 zope_tic_loop script +%import timerserver +<timer-server> + interval 5 +</timer-server> -- 2.30.9