[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/Browser - metaConfigure.py:1.1.2.6
Jim Fulton
jim@zope.com
Thu, 3 Jan 2002 14:29:25 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Publisher/Browser
In directory cvs.zope.org:/tmp/cvs-serv16747/Publisher/Browser
Modified Files:
Tag: Zope-3x-branch
metaConfigure.py
Log Message:
Refactored configuration framework:
- Configuration directives must be written to a
a different framework. See
ConfigurationDirectiveInterfaces.
- Configuration directives now don't take actions immediately.
Instead, they return a sequence of discriminators and callables
objects with arguments. This allows configuration to be defered to
allow overriding and conflct detection.
- Can now detect conflicting directives
- Can override directives. Directives in including configuration files
override directives in included files. Conflicting directives are
decided based on discriminators.
- Added new directives for defining directives. All directives, except
for a few bootstrap irectives, are now configurable in the
configuration file. This makes directives a little more discoverable
and facilitates extension of directives.
=== Zope3/lib/python/Zope/Publisher/Browser/metaConfigure.py 1.1.2.5 => 1.1.2.6 ===
# FOR A PARTICULAR PURPOSE.
from Zope.ComponentArchitecture import provideView
-from Zope.Configuration.meta import register
from Zope.Configuration.name import resolve
-from Zope.Configuration import namespace
from IBrowserPublisher import IBrowserPublisher
-def provideDefaultBrowserView(name, component, for_=None):
+def defaultView(name, component, for_=None):
if for_ is not None:
for_ = resolve(for_)
component = resolve(component)
- provideView(for_, name, IBrowserPublisher, component)
- provideView(for_, '', IBrowserPublisher, component)
+
+ return [
+ (('view', for_, name, IBrowserPublisher),
+ provideView, (for_, name, IBrowserPublisher, component)),
+ (('view', for_, '', IBrowserPublisher),
+ provideView, (for_, '', IBrowserPublisher, component)),
+ ]
-def provideBrowserView(name, component, for_=None):
+def view(name, component, for_=None):
if for_ is not None:
for_ = resolve(for_)
component = resolve(component)
- provideView(for_, name, IBrowserPublisher, component)
-
-def metaConfigure():
- register(namespace('browser'), 'view', provideBrowserView)
- register(namespace('browser'), 'defaultView',
- provideDefaultBrowserView)
+
+ return [
+ (('view', for_, name, IBrowserPublisher),
+ provideView, (for_, name, IBrowserPublisher, component)),
+ ]