[Checkins] SVN: zope.generic/trunk/src/zope/generic/controller/ add
new controller package: work in progress!
Dominik Huber
dominik.huber at perse.ch
Mon Apr 10 18:19:24 EDT 2006
Log message for revision 66821:
add new controller package: work in progress!
Changed:
A zope.generic/trunk/src/zope/generic/controller/
A zope.generic/trunk/src/zope/generic/controller/README.txt
A zope.generic/trunk/src/zope/generic/controller/SETUP.cfg
A zope.generic/trunk/src/zope/generic/controller/__init__.py
A zope.generic/trunk/src/zope/generic/controller/configure.zcml
A zope.generic/trunk/src/zope/generic/controller/interfaces.py
A zope.generic/trunk/src/zope/generic/controller/zope.generic.controller-configure.zcml
-=-
Added: zope.generic/trunk/src/zope/generic/controller/README.txt
===================================================================
--- zope.generic/trunk/src/zope/generic/controller/README.txt 2006-04-10 22:10:58 UTC (rev 66820)
+++ zope.generic/trunk/src/zope/generic/controller/README.txt 2006-04-10 22:19:23 UTC (rev 66821)
@@ -0,0 +1,22 @@
+==========
+Controller
+==========
+
+The controller is a single instance registered for an interface-key marker
+registered as generic type.
+
+ >>> registerDirective('''
+ ... <generic:controller
+ ... interface="example.IBarMarker"
+ ... class='zope.generic.type.api.Object'
+ ... >
+ ... <initializer
+ ... interface='example.IOtherConfiguration'
+ ... handler='example.barInitializer'
+ ... />
+ ... <configuration
+ ... interface='example.IAnyConfiguration'
+ ... data='example.typedata'
+ ... />
+ ... </generic:type>
+ ... ''')
Property changes on: zope.generic/trunk/src/zope/generic/controller/README.txt
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: zope.generic/trunk/src/zope/generic/controller/SETUP.cfg
===================================================================
--- zope.generic/trunk/src/zope/generic/controller/SETUP.cfg 2006-04-10 22:10:58 UTC (rev 66820)
+++ zope.generic/trunk/src/zope/generic/controller/SETUP.cfg 2006-04-10 22:19:23 UTC (rev 66821)
@@ -0,0 +1,3 @@
+<data-files zopeskel/etc/package-includes>
+ zope.generic.controller-*.zcml
+</data-files>
\ No newline at end of file
Property changes on: zope.generic/trunk/src/zope/generic/controller/SETUP.cfg
___________________________________________________________________
Name: svn:keywords
+ Id
Added: zope.generic/trunk/src/zope/generic/controller/__init__.py
===================================================================
--- zope.generic/trunk/src/zope/generic/controller/__init__.py 2006-04-10 22:10:58 UTC (rev 66820)
+++ zope.generic/trunk/src/zope/generic/controller/__init__.py 2006-04-10 22:19:23 UTC (rev 66821)
@@ -0,0 +1,19 @@
+##############################################################################
+#
+# Copyright (c) 2005, 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+
+"""
+$Id$
+"""
+
+from zope.generic.configurator.interfaces import *
\ No newline at end of file
Property changes on: zope.generic/trunk/src/zope/generic/controller/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: zope.generic/trunk/src/zope/generic/controller/configure.zcml
===================================================================
--- zope.generic/trunk/src/zope/generic/controller/configure.zcml 2006-04-10 22:10:58 UTC (rev 66820)
+++ zope.generic/trunk/src/zope/generic/controller/configure.zcml 2006-04-10 22:19:23 UTC (rev 66821)
@@ -0,0 +1,6 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:generic="http://namespaces.zope.org/generic"
+ i18n_domain="zope">
+
+</configure>
Property changes on: zope.generic/trunk/src/zope/generic/controller/configure.zcml
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: zope.generic/trunk/src/zope/generic/controller/interfaces.py
===================================================================
--- zope.generic/trunk/src/zope/generic/controller/interfaces.py 2006-04-10 22:10:58 UTC (rev 66820)
+++ zope.generic/trunk/src/zope/generic/controller/interfaces.py 2006-04-10 22:19:23 UTC (rev 66821)
@@ -0,0 +1,159 @@
+##############################################################################
+#
+# Copyright (c) 2005, 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+
+"""
+$Id$
+"""
+
+__docformat__ = 'restructuredtext'
+
+from zope.app.annotation import IAnnotations
+from zope.app.i18n import ZopeMessageFactory as _
+from zope.interface import Interface
+from zope.schema import Bool
+from zope.schema import Object
+from zope.schema import Tuple
+
+from zope.generic.component import IInterfaceKey
+from zope.generic.configuration import IConfiguraitons
+from zope.generic.type import ITypeType
+
+
+
+class IHandler(Interface):
+ """ """
+ def __call__(controller, event=None):
+ """Handle the controller's context."""
+
+
+
+class IHandlerConfiguration(Interface):
+ """Tell the controller which handler should be invoked."""
+
+ preHandlers = Tuple(title=_('Pre-Handlers'),
+ description=_('Handler that should be invoked before the Super-Call.'),
+ required=False,
+ default=(),
+ value_type=Object(schema=IHandler))
+
+ postHandlers = Tuple(title=_('Post-Handlers'),
+ description=_('Handler that should be invoked after the Super-Call.'),
+ required=False,
+ default=(),
+ value_type=Object(schema=IHandler))
+
+ callSupers = Bool(title=_('Call Super'),
+ description=_('Should the supers be called?'),
+ default=False)
+
+class IInitializeConfiguration(IHandlerConfiguration):
+ """Configuration for initializer handlers."""
+
+class IModifyConfiguration(IHandlerConfiguration):
+ """Configuration for adder handlers."""
+
+class IAddConfiguration(IHandlerConfiguration):
+ """Configuration for adder handlers."""
+
+
+class IMoveConfiguration(IHandlerConfiguration):
+ """Configuration for adder handlers."""
+
+
+class IRemoveConfiguration(IHandlerConfiguration):
+ """Configuration for adder handlers."""
+
+
+class IUpdateConfiguration(IHandlerConfiguration):
+ """Configuration for adder handlers."""
+
+alsoProvides(IControllerConfiguration, IConfigurationType)
+
+
+class IListener(IInterfaceKey):
+ """Listen as a subscriber to events defined by the interface."""
+
+ def __call__(component, event):
+ """Redirect the call to the controller.
+ name = toDottedName()
+ controller = IController(component, event)
+
+
+
+
+
+ """
+
+
+
+class IController(Interface):
+ """Apply dedicated handlers to a component context.
+
+ The controller should invoke the handler in a object-oriented manner.
+
+ Object-orientation provides an overwrites-mechanism within an inheritance
+ hierarchy. There are to possibilities for an certain class of that
+ inheritance tree to be invoke by a call:
+
+ def method(x):
+ # before the supers will be called
+ any_pre_super_call_procedures(x)
+ # super call
+ super_call(x)
+ # after the supers were called.
+ any_post_super_call_procedures(x)
+
+ We can observe an generalizing information flow from specialized to
+ generalized (preSuperCall) and an specializing information flow
+ from generalized to specialized (postSuperCall). an configurator will
+ """
+
+
+ context = Object(title=_('Context'),
+ description=_('The context that should be configured.'),
+ default=True)
+
+ def __call__(event=None):
+ """Apply the handlers.
+
+ First invoke the pre-handlers defined by the interface-inheritance order
+ of the interface-key marker as listed in inface-key.flattened() call if
+ the interface provides ITypeType.
+
+ Second invoke the post-handlers in the inverse order.
+
+ id = ITyped(component).interface
+ if callSupers:
+ interfaces = [iface for iface in id.flattened if ITypeType.providedBy(iface)]
+ else:
+ interfaces = [id]
+
+ for iface in interfaces:
+ getAdapter(component, [IController], name=toDottedName(id))
+
+ """
+
+ configurations = Object(
+ title=_('Configurations'),
+ description=_('The configurations of the component.'),
+ required=False,
+ readonly=True,
+ schema=IConfigurations)
+
+ annotations = Object(
+ title=_('Annotations'),
+ description=_('The annotations of the component.'),
+ required=False,
+ readonly=True,
+ schema=IAnnotations)
Property changes on: zope.generic/trunk/src/zope/generic/controller/interfaces.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: zope.generic/trunk/src/zope/generic/controller/zope.generic.controller-configure.zcml
===================================================================
--- zope.generic/trunk/src/zope/generic/controller/zope.generic.controller-configure.zcml 2006-04-10 22:10:58 UTC (rev 66820)
+++ zope.generic/trunk/src/zope/generic/controller/zope.generic.controller-configure.zcml 2006-04-10 22:19:23 UTC (rev 66821)
@@ -0,0 +1,5 @@
+<configure xmlns="http://namespaces.zope.org/zope">
+
+ <include package="zope.generic.controller" />
+
+</configure>
Property changes on: zope.generic/trunk/src/zope/generic/controller/zope.generic.controller-configure.zcml
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
More information about the Checkins
mailing list