Commit cca0f2fa authored by Tres Seaver's avatar Tres Seaver

Added a 'product-config' section type to zope.conf, allowing arbitrary key-value mappings.

Products can look for such confgiurations to set product-specific options
(see the example '<product-config>' section in skel/etc/zope.conf.in
for sample usage).
parent ffa2185c
......@@ -26,6 +26,12 @@ Zope Changes
Features added
- Added a 'product-config' section type to zope.conf, allowing
arbitrary key-value mappings. Products can look for such
confgiurations to set product-specific options (see the
example '<product-config>' section in skel/etc/zope.conf.in
for sample usage).
- Collector #1490: Added a new zope.conf option to control the
character set used to encode unicode data that reaches
ZPublisher without any specified encoding.
......
......@@ -150,6 +150,12 @@ def root_config(section):
from DBTab.DBTab import DBTab
section.dbtab = DBTab(mount_factories, mount_points)
pconfigs = {}
for pconfig in section.product_config:
pconfigs[pconfig.getSectionName()] = pconfig.mapping
section.product_config = pconfigs
return section
class ZopeDatabase(ZODBDatabase):
......@@ -221,3 +227,6 @@ def default_zpublisher_encoding(value):
Converters.default_encoding = value
HTTPRequest.default_encoding = value
HTTPResponse.default_encoding = value
class ProductConfig(dict):
pass
......@@ -821,5 +821,23 @@
<metadefault>iso-8859-15</metadefault>
</key>
<sectiontype name="product-config">
<description>
Product-specific configuration, expressed as arbitrary name-value pairs.
</description>
<key name="+"
attribute="mapping"
required="no"
/>
</sectiontype>
<multisection type="product-config" name="+"
attribute="product_config">
<description>
Product-specific configuration, expressed as arbitrary name-value pairs.
</description>
</multisection>
</schema>
......@@ -969,3 +969,22 @@ instancehome $INSTANCE
# #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']
#
# Example:
#
# <product-config foo>
# bar baz
# </product-config>
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