[Zope3-checkins] CVS: Zope3/src/zope/configuration/tests/samplepackage - __init__.py:1.1 bar.zcml:1.1 bar1.zcml:1.1 bar2.zcml:1.1 bar21.zcml:1.1 baro.zcml:1.1 configure.zcml:1.1 configure.zcml.in:1.1 foo.py:1.1 foo.zcml.in:1.1
Jim Fulton
jim@zope.com
Mon, 28 Jul 2003 18:23:19 -0400
Update of /cvs-repository/Zope3/src/zope/configuration/tests/samplepackage
In directory cvs.zope.org:/tmp/cvs-serv30798/src/zope/configuration/tests/samplepackage
Added Files:
__init__.py bar.zcml bar1.zcml bar2.zcml bar21.zcml baro.zcml
configure.zcml configure.zcml.in foo.py foo.zcml.in
Log Message:
Major refactoring of the configuration system. Now use a totally new
architecture based on:
- Using schema to describe directive attributes
- Treating most configuration handlers as decorators of configuration
contexts.
The benefits of this are:
- Conversion of directive input can be automated.
- Much better error reporting. We can now tell people
what attributes are missing, are extra, or have invalid
values.
- It's possible to extend existing directives without modifying them.
Extending subdirectives can even be in different namespaces, if
desired.
- There is a includeOverrides directive for including files that
contain directives overriding directives in other files.
- It is possible to have many more sorts of "grouping" directives.
This will allow things like directives that provide defaults for
other directives and perhaps even some sort of macro system.
The basic refactoring is done, but there are a number of things to be
done:
- Write new documentation on how to write directives the new and
better way.
- Update the documentation generation tool to use the new
configuration framework.
- Add i18n support. This was the motivation for the refactoring. Now
this is easy. :)
=== Added File Zope3/src/zope/configuration/tests/samplepackage/__init__.py ===
#
# This file is necessary to make this directory a package.
=== Added File Zope3/src/zope/configuration/tests/samplepackage/bar.zcml ===
<zopeConfigure>
<include file="bar1.zcml" />
<include file="bar2.zcml" />
</zopeConfigure>
=== Added File Zope3/src/zope/configuration/tests/samplepackage/bar1.zcml ===
<zopeConfigure xmlns="http://namespaces.zope.org/test">
<include file="configure.zcml" />
<foo x="blah" y="1" />
</zopeConfigure>
=== Added File Zope3/src/zope/configuration/tests/samplepackage/bar2.zcml ===
<zopeConfigure xmlns="http://namespaces.zope.org/test">
<include file="bar21.zcml" />
<foo x="blah" y="2" />
<foo x="blah" y="1" />
</zopeConfigure>
=== Added File Zope3/src/zope/configuration/tests/samplepackage/bar21.zcml ===
<zopeConfigure xmlns="http://namespaces.zope.org/test">
<foo x="blah" y="0" />
<foo x="blah" y="2" />
</zopeConfigure>
=== Added File Zope3/src/zope/configuration/tests/samplepackage/baro.zcml ===
<zopeConfigure>
<include file="bar1.zcml" />
<includeOverrides file="bar2.zcml" />
</zopeConfigure>
=== Added File Zope3/src/zope/configuration/tests/samplepackage/configure.zcml ===
<zopeConfigure xmlns="http://namespaces.zope.org/zope"
xmlns:meta="http://namespaces.zope.org/meta"
xmlns:test="http://namespaces.zope.org/test"
>
<meta:directive
namespace="http://namespaces.zope.org/test"
name="foo"
schema="zope.configuration.tests.samplepackage.foo.S1"
handler="zope.configuration.tests.samplepackage.foo.handler"
/>
<test:foo x="blah" y="0" />
</zopeConfigure>
=== Added File Zope3/src/zope/configuration/tests/samplepackage/configure.zcml.in ===
<zopeConfigure xmlns="http://namespaces.zope.org/zope">
</zopeConfigure>
=== Added File Zope3/src/zope/configuration/tests/samplepackage/foo.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Sample module used for testing
$Id: foo.py,v 1.1 2003/07/28 22:23:08 jim Exp $
"""
from zope.interface import Interface
from zope import schema
data = []
class S1(Interface):
x = schema.BytesLine()
y = schema.Int()
class stuff:
def __init__(self, args, info, basepath, package, includepath):
(self.args, self.info, self.basepath, self.package, self.includepath
) = args, info, basepath, package, includepath
def handler(_context, **kw):
args = kw.items()
args.sort()
args = tuple(args)
discriminator = args
args = (stuff(args, _context.info, _context.basepath, _context.package,
_context.includepath), )
_context.action(discriminator, data.append, args)
=== Added File Zope3/src/zope/configuration/tests/samplepackage/foo.zcml.in ===
<zopeConfigure xmlns="http://namespaces.zope.org/zope"
xmlns:meta="http://namespaces.zope.org/meta"
xmlns:test="http://namespaces.zope.org/test"
>
<meta:directive
namespace="http://namespaces.zope.org/test"
name="foo"
schema="zope.configuration.tests.samplepackage.foo.S1"
handler="zope.configuration.tests.samplepackage.foo.handler"
/>
<test:foo x="foo" y="2" />
</zopeConfigure>