Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
82701778
Commit
82701778
authored
Oct 26, 2005
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow custom section types to play in <product-config>.
parent
cca0f2fa
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
14 deletions
+66
-14
doc/CHANGES.txt
doc/CHANGES.txt
+4
-3
lib/python/Zope2/Startup/datatypes.py
lib/python/Zope2/Startup/datatypes.py
+10
-4
lib/python/Zope2/Startup/zopeschema.xml
lib/python/Zope2/Startup/zopeschema.xml
+20
-4
skel/etc/zope.conf.in
skel/etc/zope.conf.in
+32
-3
No files found.
doc/CHANGES.txt
View file @
82701778
...
@@ -28,9 +28,10 @@ Zope Changes
...
@@ -28,9 +28,10 @@ Zope Changes
- Added a 'product-config' section type to zope.conf, allowing
- Added a 'product-config' section type to zope.conf, allowing
arbitrary key-value mappings. Products can look for such
arbitrary key-value mappings. Products can look for such
confgiurations to set product-specific options (see the
confgiurations to set product-specific options. Products mwy
example '<product-config>' section in skel/etc/zope.conf.in
also register their own section types, extending the
for sample usage).
'zope.product.base' type. (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
- Collector #1490: Added a new zope.conf option to control the
character set used to encode unicode data that reaches
character set used to encode unicode data that reaches
...
...
lib/python/Zope2/Startup/datatypes.py
View file @
82701778
...
@@ -113,6 +113,7 @@ def python_dotted_path(name):
...
@@ -113,6 +113,7 @@ def python_dotted_path(name):
def
root_config
(
section
):
def
root_config
(
section
):
from
ZConfig
import
ConfigurationError
from
ZConfig
import
ConfigurationError
from
ZConfig.matcher
import
SectionValue
here
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
here
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
swhome
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
here
))
swhome
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
here
))
section
.
softwarehome
=
swhome
section
.
softwarehome
=
swhome
...
@@ -152,7 +153,15 @@ def root_config(section):
...
@@ -152,7 +153,15 @@ def root_config(section):
pconfigs
=
{}
pconfigs
=
{}
for
pconfig
in
section
.
product_config
:
for
pconfig
in
section
.
product_config
:
pconfigs
[
pconfig
.
getSectionName
()]
=
pconfig
.
mapping
section_name
=
pconfig
.
getSectionName
()
if
isinstance
(
pconfig
,
SectionValue
):
section_type
=
pconfig
.
getSectionType
()
if
section_type
==
'product-config'
:
pconfigs
[
section_name
]
=
pconfig
.
mapping
else
:
pconfigs
[
section_name
]
=
pconfig
else
:
pconfigs
[
section_name
]
=
pconfig
section
.
product_config
=
pconfigs
section
.
product_config
=
pconfigs
...
@@ -227,6 +236,3 @@ def default_zpublisher_encoding(value):
...
@@ -227,6 +236,3 @@ def default_zpublisher_encoding(value):
Converters
.
default_encoding
=
value
Converters
.
default_encoding
=
value
HTTPRequest
.
default_encoding
=
value
HTTPRequest
.
default_encoding
=
value
HTTPResponse
.
default_encoding
=
value
HTTPResponse
.
default_encoding
=
value
class
ProductConfig
(
dict
):
pass
lib/python/Zope2/Startup/zopeschema.xml
View file @
82701778
...
@@ -821,7 +821,18 @@
...
@@ -821,7 +821,18 @@
<metadefault>
iso-8859-15
</metadefault>
<metadefault>
iso-8859-15
</metadefault>
</key>
</key>
<sectiontype
name=
"product-config"
>
<abstracttype
name=
"zope.product.base"
>
<description>
Base type for product-specific configuration sections.
Specific products should implement configuration sections by
defining section types that implement this abstract type and
using their own schema component to define meaningful settings.
</description>
</abstracttype>
<sectiontype
name=
"product-config"
implements=
"zope.product.base"
>
<description>
<description>
Product-specific configuration, expressed as arbitrary name-value pairs.
Product-specific configuration, expressed as arbitrary name-value pairs.
</description>
</description>
...
@@ -832,12 +843,17 @@
...
@@ -832,12 +843,17 @@
/>
/>
</sectiontype>
</sectiontype>
<multisection
type=
"
product-config
"
name=
"+"
<multisection
type=
"
zope.product.base
"
name=
"+"
attribute=
"product_config"
>
attribute=
"product_config"
>
<description>
<description>
Product-specific configuration, expressed as arbitrary name-value pairs.
Product-specific configuration stanzas.
Products may use the
<
product-config
>
section type, or may supply
a component.xml which defines section types with their own schemas.
All sections for this multisection will be collected into the
'product_config' attribute of the configuration object.
</description>
</description>
</multisection>
</multisection>
</schema>
</schema>
skel/etc/zope.conf.in
View file @
82701778
...
@@ -983,8 +983,37 @@ instancehome $INSTANCE
...
@@ -983,8 +983,37 @@ instancehome $INSTANCE
# parsed into a dict, {'bar': 'baz'}, available as
# parsed into a dict, {'bar': 'baz'}, available as
# config.product_config['foo']
# config.product_config['foo']
#
#
# Products may also register their own section types, extending
#
#
# Example:
# Example:
#
#
# 1. Simple "bag of strings" section:
#
# <product-config foo>
# <product-config foo>
# bar baz
# bar baz
# </product-config>
# </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>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment