[Zope3-checkins] SVN: Zope3/branches/jim-adapter/src/zope/ Move directive schemas and handlers of elementary directives (adapter, subscriber,

Philipp von Weitershausen philikon at philikon.de
Tue Apr 11 06:03:11 EDT 2006


Log message for revision 66842:
  Move directive schemas and handlers of elementary directives (adapter, subscriber,
  utility) to zope.component.zcml.  Tests aren't moved yet (and BBB isn't provided either)
  

Changed:
  U   Zope3/branches/jim-adapter/src/zope/app/apidoc/codemodule/metaconfigure.py
  U   Zope3/branches/jim-adapter/src/zope/app/component/browser/metaconfigure.py
  U   Zope3/branches/jim-adapter/src/zope/app/component/browser/tests/test_directives.py
  U   Zope3/branches/jim-adapter/src/zope/app/component/contentdirective.py
  U   Zope3/branches/jim-adapter/src/zope/app/component/meta.zcml
  U   Zope3/branches/jim-adapter/src/zope/app/component/metaconfigure.py
  U   Zope3/branches/jim-adapter/src/zope/app/component/metadirectives.py
  U   Zope3/branches/jim-adapter/src/zope/app/component/tests/test_directives.py
  U   Zope3/branches/jim-adapter/src/zope/app/dav/metaconfigure.py
  U   Zope3/branches/jim-adapter/src/zope/app/mail/metaconfigure.py
  U   Zope3/branches/jim-adapter/src/zope/app/preference/metaconfigure.py
  U   Zope3/branches/jim-adapter/src/zope/app/publisher/browser/i18nresourcemeta.py
  U   Zope3/branches/jim-adapter/src/zope/app/publisher/browser/icon.py
  U   Zope3/branches/jim-adapter/src/zope/app/publisher/browser/menumeta.py
  U   Zope3/branches/jim-adapter/src/zope/app/publisher/browser/metaconfigure.py
  U   Zope3/branches/jim-adapter/src/zope/app/publisher/browser/resourcemeta.py
  U   Zope3/branches/jim-adapter/src/zope/app/publisher/browser/viewmeta.py
  U   Zope3/branches/jim-adapter/src/zope/app/publisher/xmlrpc/metaconfigure.py
  U   Zope3/branches/jim-adapter/src/zope/app/renderer/metaconfigure.py
  U   Zope3/branches/jim-adapter/src/zope/app/schema/metaconfigure.py
  U   Zope3/branches/jim-adapter/src/zope/app/security/metaconfigure.py
  U   Zope3/branches/jim-adapter/src/zope/app/securitypolicy/metaconfigure.py
  U   Zope3/branches/jim-adapter/src/zope/app/wfmc/metaconfigure.py
  A   Zope3/branches/jim-adapter/src/zope/component/zcml.py
  U   Zope3/branches/jim-adapter/src/zope/i18n/zcml.py
  U   Zope3/branches/jim-adapter/src/zope/viewlet/metaconfigure.py

-=-
Modified: Zope3/branches/jim-adapter/src/zope/app/apidoc/codemodule/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/apidoc/codemodule/metaconfigure.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/apidoc/codemodule/metaconfigure.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -17,7 +17,7 @@
 """
 __docformat__ = 'restructuredtext'
 from zope.interface import implements
-from zope.app.component.metaconfigure import utility
+from zope.component.zcml import utility
 
 from zope.app.apidoc import classregistry
 from zope.app.apidoc.codemodule.interfaces import IAPIDocRootModule

Modified: Zope3/branches/jim-adapter/src/zope/app/component/browser/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/browser/metaconfigure.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/component/browser/metaconfigure.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -15,8 +15,7 @@
 
 $Id$
 """
-from zope.app.component.metaconfigure import utility
-from zope.app.component.metaconfigure import interface as ifaceDirective
+from zope.component.zcml import utility, interface as ifaceDirective
 from tools import IToolType, IToolConfiguration, ToolConfiguration
 
 

Modified: Zope3/branches/jim-adapter/src/zope/app/component/browser/tests/test_directives.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/browser/tests/test_directives.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/component/browser/tests/test_directives.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -59,7 +59,7 @@
      'IDummyUtility']
 
     >>> tool['callable'].__module__
-    'zope.app.component.metaconfigure'
+    'zope.component.zcml'
     """
 
 def test_suite():

Modified: Zope3/branches/jim-adapter/src/zope/app/component/contentdirective.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/contentdirective.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/component/contentdirective.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -24,6 +24,7 @@
 from zope.component.interfaces import IFactory
 from zope.component.factory import Factory
 from zope.component.interface import provideInterface
+from zope.component.zcml import utility
 from zope.interface import classImplements
 from zope.schema.interfaces import IField
 from zope.configuration.exceptions import ConfigurationError
@@ -31,7 +32,6 @@
 from zope.annotation.interfaces import IAttributeAnnotatable
 
 from zope.app.component.interfaces import ILocalUtility
-from zope.app.component.metaconfigure import utility
 from zope.app.security.protectclass import protectLikeUnto, protectName
 from zope.app.security.protectclass import protectSetAttribute
 

Modified: Zope3/branches/jim-adapter/src/zope/app/component/meta.zcml
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/meta.zcml	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/component/meta.zcml	2006-04-11 10:03:07 UTC (rev 66842)
@@ -6,29 +6,29 @@
 
     <meta:directive
         name="interface"
-        schema=".metadirectives.IInterfaceDirective"
-        handler="zope.app.component.metaconfigure.interface"
+        schema="zope.component.zcml.IInterfaceDirective"
+        handler="zope.component.zcml.interface"
         />
 
     <meta:directive
         name="adapter"
-        schema=".metadirectives.IAdapterDirective"
-        handler="zope.app.component.metaconfigure.adapter"
+        schema="zope.component.zcml.IAdapterDirective"
+        handler="zope.component.zcml.adapter"
         />
 
     <meta:directive
         name="subscriber"
-        schema=".metadirectives.ISubscriberDirective"
-        handler="zope.app.component.metaconfigure.subscriber"
+        schema="zope.component.zcml.ISubscriberDirective"
+        handler="zope.component.zcml.subscriber"
         />
 
-
     <meta:directive
         name="utility"
-        schema=".metadirectives.IUtilityDirective"
-        handler="zope.app.component.metaconfigure.utility"
+        schema="zope.component.zcml.IUtilityDirective"
+        handler="zope.component.zcml.utility"
         />
 
+
     <!-- BBB 2006/02/24, to be removed after 12 months -->
     <meta:directive
         name="factory"

Modified: Zope3/branches/jim-adapter/src/zope/app/component/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/metaconfigure.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/component/metaconfigure.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -18,253 +18,18 @@
 __docformat__ = 'restructuredtext'
 
 import warnings
-import zope.interface
 import zope.component
 from zope import component
+from zope.interface import Interface
+from zope.component.zcml import handler, proxify, utility
+from zope.component.interface import provideInterface
 from zope.component.interfaces import IDefaultViewName, IFactory
 from zope.configuration.exceptions import ConfigurationError
-from zope.interface import Interface, providedBy
-from zope.interface.interfaces import IInterface
-from zope.proxy import ProxyBase, getProxiedObject
-
-from zope.security.checker import InterfaceChecker, CheckerPublic
+from zope.security.checker import CheckerPublic
 from zope.security.checker import Checker, NamesChecker
-from zope.security.proxy import Proxy
-from zope.security.adapter import LocatingTrustedAdapterFactory
-from zope.security.adapter import LocatingUntrustedAdapterFactory
-from zope.security.adapter import TrustedAdapterFactory
 
 PublicPermission = 'zope.Public'
 
-def handler(methodName, *args, **kwargs):
-    method=getattr(zope.component.getGlobalSiteManager(), methodName)
-    method(*args, **kwargs)
-
-from zope.component.interface import provideInterface
-def interface(_context, interface, type=None, name=''):
-    _context.action(
-        discriminator = None,
-        callable = provideInterface,
-        args = (name, interface, type)
-        )
-
-
-class PermissionProxy(ProxyBase):
-
-    __slots__ = ('__Security_checker__', )
-
-    def __providedBy__(self):
-        return providedBy(getProxiedObject(self))
-    __providedBy__ = property(__providedBy__)
-
-def proxify(ob, checker):
-    """Try to get the object proxied with the `checker`, but not too soon
-
-    We really don't want to proxy the object unless we need to.
-    """
-
-    ob = PermissionProxy(ob)
-    ob.__Security_checker__ = checker
-    return ob
-
-_handler=handler
-def subscriber(_context, for_=None, factory=None, handler=None, provides=None,
-               permission=None, trusted=False, locate=False):
-
-
-    if factory is None:
-        if handler is None:
-            raise TypeError("No factory or handler provided")
-        if provides is not None:
-            raise TypeError("Cannot use handler with provides")
-        factory = handler
-    else:
-        if handler is not None:
-            raise TypeError("Cannot use handler with factory")
-        if provides is None:
-            import warnings
-            warnings.warn(
-                "\n  %s\n"
-                "Use of factory without provides to indicate a handler "
-                "is deprecated and will change it's meaning in Zope 3.3. "
-                "Use the handler attribute instead."
-                % _context.info,
-                DeprecationWarning)
-
-    if for_ is None:
-        for_ = component.adaptedBy(factory)
-        if for_ is None:
-            raise TypeError("No for attribute was provided and can't "
-                            "determine what the factory (or handler) adapts.")
-
-    if permission is not None:
-        if permission == PublicPermission:
-            permission = CheckerPublic
-        checker = InterfaceChecker(provides, permission)
-        factory = _protectedFactory(factory, checker)
-
-    for_ = tuple(for_)
-
-    # invoke custom adapter factories
-    if locate or (permission is not None and permission is not CheckerPublic):
-        if trusted:
-            factory = LocatingTrustedAdapterFactory(factory)
-        else:
-            factory = LocatingUntrustedAdapterFactory(factory)
-    else:
-        if trusted:
-            factory = TrustedAdapterFactory(factory)
-
-    _context.action(
-        discriminator = None,
-        callable = _handler,
-        args = ('subscribe',
-                for_, provides, factory, _context.info),
-        )
-
-    if provides is not None:
-        _context.action(
-            discriminator = None,
-            callable = provideInterface,
-            args = ('', provides)
-            )
-
-    # For each interface, state that the adapter provides that interface.
-    for iface in for_:
-        if iface is not None:
-            _context.action(
-                discriminator = None,
-                callable = provideInterface,
-                args = ('', iface)
-                )
-
-def adapter(_context, factory, provides=None, for_=None, permission=None,
-            name='', trusted=False, locate=False):
-
-    if for_ is None:
-        if len(factory) == 1:
-            for_ = component.adaptedBy(factory[0])
-
-        if for_ is None:
-            raise TypeError("No for attribute was provided and can't "
-                            "determine what the factory adapts.")
-
-    for_ = tuple(for_)
-
-    if provides is None:
-        if len(factory) == 1:
-            p = list(zope.interface.implementedBy(factory[0]))
-            if len(p) == 1:
-                provides = p[0]
-
-        if provides is None:
-            raise TypeError("Missing 'provides' attribute")
-
-    # Generate a single factory from multiple factories:
-    factories = factory
-    if len(factories) == 1:
-        factory = factories[0]
-    elif len(factories) < 1:
-        raise ValueError("No factory specified")
-    elif len(factories) > 1 and len(for_) != 1:
-        raise ValueError("Can't use multiple factories and multiple for")
-    else:
-        factory = _rolledUpFactory(factories)
-
-    if permission is not None:
-        if permission == PublicPermission:
-            permission = CheckerPublic
-        checker = InterfaceChecker(provides, permission)
-        factory = _protectedFactory(factory, checker)
-
-    # invoke custom adapter factories
-    if locate or (permission is not None and permission is not CheckerPublic):
-        if trusted:
-            factory = LocatingTrustedAdapterFactory(factory)
-        else:
-            factory = LocatingUntrustedAdapterFactory(factory)
-    else:
-        if trusted:
-            factory = TrustedAdapterFactory(factory)
-
-    _context.action(
-        discriminator = ('adapter', for_, provides, name),
-        callable = handler,
-        args = ('provideAdapter',
-                for_, provides, name, factory, _context.info),
-        )
-    _context.action(
-        discriminator = None,
-        callable = provideInterface,
-        args = ('', provides)
-               )
-    if for_:
-        for iface in for_:
-            if iface is not None:
-                _context.action(
-                    discriminator = None,
-                    callable = provideInterface,
-                    args = ('', iface)
-                    )
-
-def _rolledUpFactory(factories):
-    # This has to be named 'factory', aparently, so as not to confuse
-    # apidoc :(
-    def factory(ob):
-        for f in factories:
-            ob = f(ob)
-        return ob
-    # Store the original factory for documentation
-    factory.factory = factories[0]
-    return factory
-
-def _protectedFactory(original_factory, checker):
-    # This has to be named 'factory', aparently, so as not to confuse
-    # apidoc :(
-    def factory(*args):
-        ob = original_factory(*args)
-        try:
-            ob.__Security_checker__ = checker
-        except AttributeError:
-            ob = Proxy(ob, checker)
-
-        return ob
-    factory.factory = original_factory
-    return factory
-
-
-def utility(_context, provides=None, component=None, factory=None,
-            permission=None, name=''):
-    if factory:
-        if component:
-            raise TypeError("Can't specify factory and component.")
-        component = factory()
-
-    if provides is None:
-        provides = list(zope.interface.providedBy(component))
-        if len(provides) == 1:
-            provides = provides[0]
-        else:
-            raise TypeError("Missing 'provides' attribute")
-
-    if permission is not None:
-        if permission == PublicPermission:
-            permission = CheckerPublic
-        checker = InterfaceChecker(provides, permission)
-
-        component = proxify(component, checker)
-
-    _context.action(
-        discriminator = ('utility', provides, name),
-        callable = handler,
-        args = ('registerUtility', component, provides, name),
-        )
-    _context.action(
-        discriminator = None,
-        callable = provideInterface,
-        args = (provides.__module__ + '.' + provides.getName(), provides)
-               )
-
 # BBB 2006/02/24, to be removed after 12 months
 def factory(_context, component, id, title=None, description=None):
     try:

Modified: Zope3/branches/jim-adapter/src/zope/app/component/metadirectives.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/metadirectives.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/component/metadirectives.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -20,6 +20,7 @@
 import zope.configuration.fields
 import zope.interface
 import zope.schema
+from zope.component.zcml import IBasicComponentInformation
 
 import zope.app.security.fields
 import zope.app.component.fields
@@ -33,33 +34,6 @@
     specified one.
     """
 
-class IBasicComponentInformation(zope.interface.Interface):
-
-    component = zope.configuration.fields.GlobalObject(
-        title=_("Component to use"),
-        description=_("Python name of the implementation object.  This"
-                      " must identify an object in a module using the"
-                      " full dotted name.  If specified, the"
-                      " ``factory`` field must be left blank."),
-        required=False,
-        )
-
-    permission = zope.app.security.fields.Permission(
-        title=_("Permission"),
-        description=_("Permission required to use this component."),
-        required=False,
-        )
-
-    factory = zope.configuration.fields.GlobalObject(
-        title=_("Factory"),
-        description=_("Python name of a factory which can create the"
-                      " implementation object.  This must identify an"
-                      " object in a module using the full dotted name."
-                      " If specified, the ``component`` field must"
-                      " be left blank."),
-        required=False,
-        )
-
 class IBasicViewInformation(zope.interface.Interface):
     """This is the basic information for all views."""
 
@@ -147,176 +121,7 @@
         required=True
         )
 
-class IInterfaceDirective(zope.interface.Interface):
-    """
-    Define an interface
-    """
 
-    interface = zope.configuration.fields.GlobalInterface(
-        title=_("Interface"),
-        required=True,
-        )
-
-    type = zope.configuration.fields.GlobalInterface(
-        title=_("Interface type"),
-        required=False,
-        )
-
-    name = zope.schema.TextLine(
-        title=_("Name"),
-        required=False,
-        )
-
-class IAdapterDirective(zope.interface.Interface):
-    """
-    Register an adapter
-    """
-
-    factory = zope.configuration.fields.Tokens(
-        title=_("Adapter factory/factories"),
-        description=_("A list of factories (usually just one) that create"
-                      " the adapter instance."),
-        required=True,
-        value_type=zope.configuration.fields.GlobalObject()
-        )
-
-    provides = zope.configuration.fields.GlobalInterface(
-        title=_("Interface the component provides"),
-        description=_("This attribute specifies the interface the adapter"
-                      " instance must provide."),
-        required=False,
-        )
-
-    for_ = zope.configuration.fields.Tokens(
-        title=_("Specifications to be adapted"),
-        description=_("This should be a list of interfaces or classes"),
-        required=False,
-        value_type=zope.configuration.fields.GlobalObject(
-          missing_value=object(),
-          ),
-        )
-
-    permission = zope.app.security.fields.Permission(
-        title=_("Permission"),
-        description=_("This adapter is only available, if the principal"
-                      " has this permission."),
-        required=False,
-        )
-
-    name = zope.schema.TextLine(
-        title=_("Name"),
-        description=_("Adapters can have names.\n\n"
-                      "This attribute allows you to specify the name for"
-                      " this adapter."),
-        required=False,
-        )
-
-    trusted = zope.configuration.fields.Bool(
-        title=_("Trusted"),
-        description=_("""Make the adapter a trusted adapter
-
-        Trusted adapters have unfettered access to the objects they
-        adapt.  If asked to adapt security-proxied objects, then,
-        rather than getting an unproxied adapter of security-proxied
-        objects, you get a security-proxied adapter of unproxied
-        objects.
-        """),
-        required=False,
-        default=False,
-        )
-
-    locate = zope.configuration.fields.Bool(
-        title=_("Locate"),
-        description=_("""Make the adapter a locatable adapter
-
-        Located adapter should be used if a non-public permission
-        is used.
-        """),
-        required=False,
-        default=False,
-        )
-
-class ISubscriberDirective(zope.interface.Interface):
-    """
-    Register a subscriber
-    """
-
-    factory = zope.configuration.fields.GlobalObject(
-        title=_("Subscriber factory"),
-        description=_("A factory used to create the subscriber instance."),
-        required=False,
-        )
-
-    handler = zope.configuration.fields.GlobalObject(
-        title=_("Handler"),
-        description=_("A callable object that handles events."),
-        required=False,
-        )
-
-    provides = zope.configuration.fields.GlobalInterface(
-        title=_("Interface the component provides"),
-        description=_("This attribute specifies the interface the adapter"
-                      " instance must provide."),
-        required=False,
-        )
-
-    for_ = zope.configuration.fields.Tokens(
-        title=_("Interfaces or classes that this subscriber depends on"),
-        description=_("This should be a list of interfaces or classes"),
-        required=False,
-        value_type=zope.configuration.fields.GlobalObject(
-          missing_value = object(),
-          ),
-        )
-
-    permission = zope.app.security.fields.Permission(
-        title=_("Permission"),
-        description=_("This subscriber is only available, if the"
-                      " principal has this permission."),
-        required=False,
-        )
-
-    trusted = zope.configuration.fields.Bool(
-        title=_("Trusted"),
-        description=_("""Make the subscriber a trusted subscriber
-
-        Trusted subscribers have unfettered access to the objects they
-        adapt.  If asked to adapt security-proxied objects, then,
-        rather than getting an unproxied subscriber of security-proxied
-        objects, you get a security-proxied subscriber of unproxied
-        objects.
-        """),
-        required=False,
-        default=False,
-        )
-
-    locate = zope.configuration.fields.Bool(
-        title=_("Locate"),
-        description=_("""Make the subscriber a locatable subscriber
-
-        Located subscribers should be used if a non-public permission
-        is used.
-        """),
-        required=False,
-        default=False,
-        )
-
-class IUtilityDirective(IBasicComponentInformation):
-    """Register a utility."""
-
-    provides = zope.configuration.fields.GlobalInterface(
-        title=_("Provided interface"),
-        description=_("Interface provided by the utility."),
-        required=False,
-        )
-
-    name = zope.schema.TextLine(
-        title=_("Name"),
-        description=_("Name of the registration.  This is used by"
-                      " application code when locating a utility."),
-        required=False,
-        )
-
 # BBB 2006/02/24, to be removed after 12 months
 class IFactoryDirective(zope.interface.Interface):
     """Define a factory"""

Modified: Zope3/branches/jim-adapter/src/zope/app/component/tests/test_directives.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/tests/test_directives.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/component/tests/test_directives.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -28,6 +28,7 @@
 from zope.component.registry import SubscriptionRegistration
 from zope.component.interfaces import ComponentLookupError
 from zope.component.interface import queryInterface
+from zope.component.zcml import interface
 
 from zope.configuration.xmlconfig import xmlconfig, XMLConfig
 from zope.configuration.exceptions import ConfigurationError
@@ -38,7 +39,6 @@
 import zope.app.component
 from zope.app import zapi
 from zope.app.testing.placelesssetup import PlacelessSetup
-from zope.app.component.metaconfigure import interface
 from zope.app.component.tests.adapter import A1, A2, A3, Handler
 from zope.app.component.tests.adapter import I1, I2, I3, IS
 from zope.app.component.tests.components import IContent, Content, Comp, comp

Modified: Zope3/branches/jim-adapter/src/zope/app/dav/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/dav/metaconfigure.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/dav/metaconfigure.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -17,9 +17,9 @@
 """
 __docformat__ = 'restructuredtext'
 
-from zope.app.component.metaconfigure import utility
+from zope.component.zcml import utility
 from zope.interface import directlyProvides
-from interfaces import IDAVNamespace
+from zope.app.dav.interfaces import IDAVNamespace
 
 def interface(_context, for_, interface):
     directlyProvides(interface, IDAVNamespace)

Modified: Zope3/branches/jim-adapter/src/zope/app/mail/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/mail/metaconfigure.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/mail/metaconfigure.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -17,12 +17,11 @@
 """
 __docformat__ = 'restructuredtext'
 
+from zope.component import queryUtility
+from zope.component.zcml import handler, proxify, PublicPermission
 from zope.configuration.exceptions import ConfigurationError
-
 from zope.security.checker import InterfaceChecker, CheckerPublic
 
-from zope.app import zapi
-from zope.app.component.metaconfigure import handler, proxify, PublicPermission
 from zope.app.mail.delivery import QueuedMailDelivery, DirectMailDelivery
 from zope.app.mail.delivery import QueueProcessorThread
 from zope.app.mail.interfaces import IMailer, IMailDelivery
@@ -46,7 +45,7 @@
 
         handler('registerUtility', delivery, IMailDelivery, name)
 
-        mailerObject = zapi.queryUtility(IMailer, mailer)
+        mailerObject = queryUtility(IMailer, mailer)
         if mailerObject is None:
             raise ConfigurationError("Mailer %r is not defined" %mailer)
 
@@ -64,7 +63,7 @@
 def directDelivery(_context, permission, mailer, name="Mail"):
 
     def createDirectDelivery():
-        mailerObject = zapi.queryUtility(IMailer, mailer)
+        mailerObject = queryUtility(IMailer, mailer)
         if mailerObject is None:
             raise ConfigurationError("Mailer %r is not defined" %mailer)
 

Modified: Zope3/branches/jim-adapter/src/zope/app/preference/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/preference/metaconfigure.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/preference/metaconfigure.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -16,7 +16,7 @@
 $Id: metaconfigure.py 26889 2004-08-04 04:00:36Z pruggera $
 """
 __docformat__ = 'restructuredtext'
-from zope.app.component.metaconfigure import utility
+from zope.component.zcml import utility
 
 from zope.app.preference.interfaces import IPreferenceGroup
 from zope.app.preference.preference import PreferenceGroup

Modified: Zope3/branches/jim-adapter/src/zope/app/publisher/browser/i18nresourcemeta.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/publisher/browser/i18nresourcemeta.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/publisher/browser/i18nresourcemeta.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -21,14 +21,12 @@
 from zope.publisher.interfaces.browser import IDefaultBrowserLayer
 from zope.security.proxy import Proxy
 from zope.security.checker import CheckerPublic, Checker
+from zope.component.zcml import handler
 
-from zope.app import zapi
-from zope.app.component.metaconfigure import handler
 from zope.app.publisher.fileresource import File, Image
+from zope.app.publisher.browser.i18nfileresource import I18nFileResourceFactory
 
-from i18nfileresource import I18nFileResourceFactory
 
-
 class I18nResource(object):
 
     type = IBrowserRequest

Modified: Zope3/branches/jim-adapter/src/zope/app/publisher/browser/icon.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/publisher/browser/icon.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/publisher/browser/icon.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -23,8 +23,8 @@
 from zope.configuration.exceptions import ConfigurationError
 from zope.traversing.namespace import getResource
 from zope.component.interface import provideInterface
+from zope.component.zcml import handler
 
-from zope.app.component.metaconfigure import handler
 from zope.app.publisher.browser import metaconfigure
 
 IName = re.compile('I[A-Z][a-z]')

Modified: Zope3/branches/jim-adapter/src/zope/app/publisher/browser/menumeta.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/publisher/browser/menumeta.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/publisher/browser/menumeta.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -23,9 +23,8 @@
 from zope.publisher.interfaces.browser import IDefaultBrowserLayer
 from zope.security.checker import InterfaceChecker, CheckerPublic
 from zope.component.interface import provideInterface
+from zope.component.zcml import adapter, proxify, utility
 
-from zope.app.component.metaconfigure import adapter, proxify
-from zope.app.component.metaconfigure import utility
 from zope.app.component.contentdirective import ClassDirective
 from zope.app.pagetemplate.engine import Engine
 from zope.app.container.interfaces import IAdding

Modified: Zope3/branches/jim-adapter/src/zope/app/publisher/browser/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/publisher/browser/metaconfigure.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/publisher/browser/metaconfigure.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -18,6 +18,7 @@
 import warnings
 from zope.component.interfaces import IDefaultViewName
 from zope.component.interface import provideInterface
+from zope.component.zcml import handler
 from zope.configuration.exceptions import ConfigurationError
 from zope.interface import directlyProvides
 from zope.interface.interface import InterfaceClass
@@ -25,7 +26,6 @@
 from zope.publisher.interfaces.browser import IBrowserSkinType
 
 from zope.app import zapi, layers, skins
-from zope.app.component.metaconfigure import handler
 
 # referred to through ZCML
 from zope.app.publisher.browser.resourcemeta import resource

Modified: Zope3/branches/jim-adapter/src/zope/app/publisher/browser/resourcemeta.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/publisher/browser/resourcemeta.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/publisher/browser/resourcemeta.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -22,9 +22,9 @@
 from zope.publisher.interfaces.browser import IBrowserRequest
 from zope.publisher.interfaces.browser import IDefaultBrowserLayer
 from zope.security.checker import CheckerPublic, NamesChecker
+from zope.component.zcml import handler
 
 from zope.app import zapi
-from zope.app.component.metaconfigure import handler
 
 from fileresource import FileResourceFactory, ImageResourceFactory
 from pagetemplateresource import PageTemplateResourceFactory

Modified: Zope3/branches/jim-adapter/src/zope/app/publisher/browser/viewmeta.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/publisher/browser/viewmeta.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/publisher/browser/viewmeta.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -20,6 +20,7 @@
 from zope.component import queryMultiAdapter
 from zope.component.interfaces import ComponentLookupError, IDefaultViewName
 from zope.component.interface import provideInterface
+from zope.component.zcml import handler
 from zope.interface import implements, classImplements, Interface
 from zope.publisher.interfaces import NotFound
 from zope.security.checker import CheckerPublic, Checker, defineChecker
@@ -29,7 +30,6 @@
 from zope.publisher.interfaces.browser import IBrowserPublisher
 from zope.publisher.browser import BrowserView
 
-from zope.app.component.metaconfigure import handler
 from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.app.publisher.browser.menumeta import menuItemDirective

Modified: Zope3/branches/jim-adapter/src/zope/app/publisher/xmlrpc/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/publisher/xmlrpc/metaconfigure.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/publisher/xmlrpc/metaconfigure.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -21,8 +21,8 @@
 from zope.configuration.exceptions import ConfigurationError
 from zope.publisher.interfaces.xmlrpc import IXMLRPCRequest
 from zope.component.interface import provideInterface
+from zope.component.zcml import handler
 
-from zope.app.component.metaconfigure import handler
 from zope.app.publisher.xmlrpc import MethodPublisher
 
 def view(_context, for_=None, interface=None, methods=None,

Modified: Zope3/branches/jim-adapter/src/zope/app/renderer/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/renderer/metaconfigure.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/renderer/metaconfigure.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -18,8 +18,7 @@
 # BBB 2006/02/24, to be removed after 12 months
 
 import warnings
-from zope.app import zapi
-from zope.app.component.metaconfigure import handler
+from zope.component.zcml import handler
 from zope.configuration.fields import GlobalInterface, GlobalObject
 from zope.interface import Interface
 

Modified: Zope3/branches/jim-adapter/src/zope/app/schema/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/schema/metaconfigure.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/schema/metaconfigure.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -18,7 +18,7 @@
 import warnings
 from zope.interface import directlyProvides
 from zope.schema.interfaces import IVocabularyFactory
-from zope.app.component.metaconfigure import utility
+from zope.component.zcml import utility
 
 class FactoryKeywordPasser(object):
     """Helper that passes additional keywords to the actual factory."""

Modified: Zope3/branches/jim-adapter/src/zope/app/security/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/security/metaconfigure.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/security/metaconfigure.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -15,15 +15,13 @@
 
 $Id$
 """
-
 from zope import component
+from zope.component.zcml import utility
 from zope.security.checker import moduleChecker, Checker, defineChecker
 from zope.security.checker import CheckerPublic
 from zope.security.management import setSecurityPolicy
 from zope.security.interfaces import IPermission
 
-from zope.app.component.metaconfigure import utility
-
 from zope.app.security.permission import Permission
 from zope.app.security import principalregistry
 from zope.app.security import interfaces

Modified: Zope3/branches/jim-adapter/src/zope/app/securitypolicy/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/securitypolicy/metaconfigure.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/securitypolicy/metaconfigure.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -16,7 +16,7 @@
 $Id$
 """
 from zope.configuration.exceptions import ConfigurationError
-from zope.app.component.metaconfigure import utility
+from zope.component.zcml import utility
 
 from zope.app.securitypolicy.interfaces import IRole 
 from zope.app.securitypolicy.role import Role 

Modified: Zope3/branches/jim-adapter/src/zope/app/wfmc/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/wfmc/metaconfigure.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/app/wfmc/metaconfigure.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -20,10 +20,10 @@
 import zope.interface
 import zope.schema
 import zope.configuration.fields
+import zope.wfmc.interfaces
 from zope import wfmc
 from zope.wfmc import xpdl
-from zope.app.component.metaconfigure import utility
-import zope.wfmc.interfaces
+from zope.component.zcml import utility
 
 class IdefineXpdl(zope.interface.Interface):
 

Added: Zope3/branches/jim-adapter/src/zope/component/zcml.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/component/zcml.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/component/zcml.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -0,0 +1,456 @@
+##############################################################################
+#
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""Component Architecture configuration handlers
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import zope.component
+import zope.interface
+import zope.configuration
+from zope.component.interface import provideInterface
+from zope.proxy import ProxyBase, getProxiedObject
+from zope.security.proxy import Proxy
+from zope.security.checker import InterfaceChecker, CheckerPublic
+from zope.security.adapter import LocatingTrustedAdapterFactory
+from zope.security.adapter import LocatingUntrustedAdapterFactory
+from zope.security.adapter import TrustedAdapterFactory
+from zope.i18nmessageid import MessageFactory
+_ = MessageFactory('zope')
+
+import zope.app.security.fields
+
+PublicPermission = 'zope.Public'
+
+def handler(methodName, *args, **kwargs):
+    method = getattr(zope.component.getGlobalSiteManager(), methodName)
+    method(*args, **kwargs)
+
+class IBasicComponentInformation(zope.interface.Interface):
+
+    component = zope.configuration.fields.GlobalObject(
+        title=_("Component to use"),
+        description=_("Python name of the implementation object.  This"
+                      " must identify an object in a module using the"
+                      " full dotted name.  If specified, the"
+                      " ``factory`` field must be left blank."),
+        required=False,
+        )
+
+    permission = zope.app.security.fields.Permission(
+        title=_("Permission"),
+        description=_("Permission required to use this component."),
+        required=False,
+        )
+
+    factory = zope.configuration.fields.GlobalObject(
+        title=_("Factory"),
+        description=_("Python name of a factory which can create the"
+                      " implementation object.  This must identify an"
+                      " object in a module using the full dotted name."
+                      " If specified, the ``component`` field must"
+                      " be left blank."),
+        required=False,
+        )
+
+class IAdapterDirective(zope.interface.Interface):
+    """
+    Register an adapter
+    """
+
+    factory = zope.configuration.fields.Tokens(
+        title=_("Adapter factory/factories"),
+        description=_("A list of factories (usually just one) that create"
+                      " the adapter instance."),
+        required=True,
+        value_type=zope.configuration.fields.GlobalObject()
+        )
+
+    provides = zope.configuration.fields.GlobalInterface(
+        title=_("Interface the component provides"),
+        description=_("This attribute specifies the interface the adapter"
+                      " instance must provide."),
+        required=False,
+        )
+
+    for_ = zope.configuration.fields.Tokens(
+        title=_("Specifications to be adapted"),
+        description=_("This should be a list of interfaces or classes"),
+        required=False,
+        value_type=zope.configuration.fields.GlobalObject(
+          missing_value=object(),
+          ),
+        )
+
+    permission = zope.app.security.fields.Permission(
+        title=_("Permission"),
+        description=_("This adapter is only available, if the principal"
+                      " has this permission."),
+        required=False,
+        )
+
+    name = zope.schema.TextLine(
+        title=_("Name"),
+        description=_("Adapters can have names.\n\n"
+                      "This attribute allows you to specify the name for"
+                      " this adapter."),
+        required=False,
+        )
+
+    trusted = zope.configuration.fields.Bool(
+        title=_("Trusted"),
+        description=_("""Make the adapter a trusted adapter
+
+        Trusted adapters have unfettered access to the objects they
+        adapt.  If asked to adapt security-proxied objects, then,
+        rather than getting an unproxied adapter of security-proxied
+        objects, you get a security-proxied adapter of unproxied
+        objects.
+        """),
+        required=False,
+        default=False,
+        )
+
+    locate = zope.configuration.fields.Bool(
+        title=_("Locate"),
+        description=_("""Make the adapter a locatable adapter
+
+        Located adapter should be used if a non-public permission
+        is used.
+        """),
+        required=False,
+        default=False,
+        )
+
+def _rolledUpFactory(factories):
+    # This has to be named 'factory', aparently, so as not to confuse
+    # apidoc :(
+    def factory(ob):
+        for f in factories:
+            ob = f(ob)
+        return ob
+    # Store the original factory for documentation
+    factory.factory = factories[0]
+    return factory
+
+def _protectedFactory(original_factory, checker):
+    # This has to be named 'factory', aparently, so as not to confuse
+    # apidoc :(
+    def factory(*args):
+        ob = original_factory(*args)
+        try:
+            ob.__Security_checker__ = checker
+        except AttributeError:
+            ob = Proxy(ob, checker)
+
+        return ob
+    factory.factory = original_factory
+    return factory
+
+def adapter(_context, factory, provides=None, for_=None, permission=None,
+            name='', trusted=False, locate=False):
+
+    if for_ is None:
+        if len(factory) == 1:
+            for_ = zope.component.adaptedBy(factory[0])
+
+        if for_ is None:
+            raise TypeError("No for attribute was provided and can't "
+                            "determine what the factory adapts.")
+
+    for_ = tuple(for_)
+
+    if provides is None:
+        if len(factory) == 1:
+            p = list(zope.interface.implementedBy(factory[0]))
+            if len(p) == 1:
+                provides = p[0]
+
+        if provides is None:
+            raise TypeError("Missing 'provides' attribute")
+
+    # Generate a single factory from multiple factories:
+    factories = factory
+    if len(factories) == 1:
+        factory = factories[0]
+    elif len(factories) < 1:
+        raise ValueError("No factory specified")
+    elif len(factories) > 1 and len(for_) != 1:
+        raise ValueError("Can't use multiple factories and multiple for")
+    else:
+        factory = _rolledUpFactory(factories)
+
+    if permission is not None:
+        if permission == PublicPermission:
+            permission = CheckerPublic
+        checker = InterfaceChecker(provides, permission)
+        factory = _protectedFactory(factory, checker)
+
+    # invoke custom adapter factories
+    if locate or (permission is not None and permission is not CheckerPublic):
+        if trusted:
+            factory = LocatingTrustedAdapterFactory(factory)
+        else:
+            factory = LocatingUntrustedAdapterFactory(factory)
+    else:
+        if trusted:
+            factory = TrustedAdapterFactory(factory)
+
+    _context.action(
+        discriminator = ('adapter', for_, provides, name),
+        callable = handler,
+        args = ('provideAdapter',
+                for_, provides, name, factory, _context.info),
+        )
+    _context.action(
+        discriminator = None,
+        callable = provideInterface,
+        args = ('', provides)
+               )
+    if for_:
+        for iface in for_:
+            if iface is not None:
+                _context.action(
+                    discriminator = None,
+                    callable = provideInterface,
+                    args = ('', iface)
+                    )
+
+class ISubscriberDirective(zope.interface.Interface):
+    """
+    Register a subscriber
+    """
+
+    factory = zope.configuration.fields.GlobalObject(
+        title=_("Subscriber factory"),
+        description=_("A factory used to create the subscriber instance."),
+        required=False,
+        )
+
+    handler = zope.configuration.fields.GlobalObject(
+        title=_("Handler"),
+        description=_("A callable object that handles events."),
+        required=False,
+        )
+
+    provides = zope.configuration.fields.GlobalInterface(
+        title=_("Interface the component provides"),
+        description=_("This attribute specifies the interface the adapter"
+                      " instance must provide."),
+        required=False,
+        )
+
+    for_ = zope.configuration.fields.Tokens(
+        title=_("Interfaces or classes that this subscriber depends on"),
+        description=_("This should be a list of interfaces or classes"),
+        required=False,
+        value_type=zope.configuration.fields.GlobalObject(
+          missing_value = object(),
+          ),
+        )
+
+    permission = zope.app.security.fields.Permission(
+        title=_("Permission"),
+        description=_("This subscriber is only available, if the"
+                      " principal has this permission."),
+        required=False,
+        )
+
+    trusted = zope.configuration.fields.Bool(
+        title=_("Trusted"),
+        description=_("""Make the subscriber a trusted subscriber
+
+        Trusted subscribers have unfettered access to the objects they
+        adapt.  If asked to adapt security-proxied objects, then,
+        rather than getting an unproxied subscriber of security-proxied
+        objects, you get a security-proxied subscriber of unproxied
+        objects.
+        """),
+        required=False,
+        default=False,
+        )
+
+    locate = zope.configuration.fields.Bool(
+        title=_("Locate"),
+        description=_("""Make the subscriber a locatable subscriber
+
+        Located subscribers should be used if a non-public permission
+        is used.
+        """),
+        required=False,
+        default=False,
+        )
+
+_handler = handler
+def subscriber(_context, for_=None, factory=None, handler=None, provides=None,
+               permission=None, trusted=False, locate=False):
+    if factory is None:
+        if handler is None:
+            raise TypeError("No factory or handler provided")
+        if provides is not None:
+            raise TypeError("Cannot use handler with provides")
+        factory = handler
+    else:
+        if handler is not None:
+            raise TypeError("Cannot use handler with factory")
+        if provides is None:
+            import warnings
+            warnings.warn(
+                "\n  %s\n"
+                "Use of factory without provides to indicate a handler "
+                "is deprecated and will change it's meaning in Zope 3.3. "
+                "Use the handler attribute instead."
+                % _context.info,
+                DeprecationWarning)
+
+    if for_ is None:
+        for_ = zope.component.adaptedBy(factory)
+        if for_ is None:
+            raise TypeError("No for attribute was provided and can't "
+                            "determine what the factory (or handler) adapts.")
+
+    if permission is not None:
+        if permission == PublicPermission:
+            permission = CheckerPublic
+        checker = InterfaceChecker(provides, permission)
+        factory = _protectedFactory(factory, checker)
+
+    for_ = tuple(for_)
+
+    # invoke custom adapter factories
+    if locate or (permission is not None and permission is not CheckerPublic):
+        if trusted:
+            factory = LocatingTrustedAdapterFactory(factory)
+        else:
+            factory = LocatingUntrustedAdapterFactory(factory)
+    else:
+        if trusted:
+            factory = TrustedAdapterFactory(factory)
+
+    _context.action(
+        discriminator = None,
+        callable = _handler,
+        args = ('subscribe',
+                for_, provides, factory, _context.info),
+        )
+
+    if provides is not None:
+        _context.action(
+            discriminator = None,
+            callable = provideInterface,
+            args = ('', provides)
+            )
+
+    # For each interface, state that the adapter provides that interface.
+    for iface in for_:
+        if iface is not None:
+            _context.action(
+                discriminator = None,
+                callable = provideInterface,
+                args = ('', iface)
+                )
+
+class IUtilityDirective(IBasicComponentInformation):
+    """Register a utility."""
+
+    provides = zope.configuration.fields.GlobalInterface(
+        title=_("Provided interface"),
+        description=_("Interface provided by the utility."),
+        required=False,
+        )
+
+    name = zope.schema.TextLine(
+        title=_("Name"),
+        description=_("Name of the registration.  This is used by"
+                      " application code when locating a utility."),
+        required=False,
+        )
+
+class PermissionProxy(ProxyBase):
+
+    __slots__ = ('__Security_checker__', )
+
+    def __providedBy__(self):
+        return zope.interface.providedBy(getProxiedObject(self))
+    __providedBy__ = property(__providedBy__)
+
+def proxify(ob, checker):
+    """Try to get the object proxied with the `checker`, but not too soon
+
+    We really don't want to proxy the object unless we need to.
+    """
+
+    ob = PermissionProxy(ob)
+    ob.__Security_checker__ = checker
+    return ob
+
+def utility(_context, provides=None, component=None, factory=None,
+            permission=None, name=''):
+    if factory:
+        if component:
+            raise TypeError("Can't specify factory and component.")
+        component = factory()
+
+    if provides is None:
+        provides = list(zope.interface.providedBy(component))
+        if len(provides) == 1:
+            provides = provides[0]
+        else:
+            raise TypeError("Missing 'provides' attribute")
+
+    if permission is not None:
+        if permission == PublicPermission:
+            permission = CheckerPublic
+        checker = InterfaceChecker(provides, permission)
+
+        component = proxify(component, checker)
+
+    _context.action(
+        discriminator = ('utility', provides, name),
+        callable = handler,
+        args = ('registerUtility', component, provides, name),
+        )
+    _context.action(
+        discriminator = None,
+        callable = provideInterface,
+        args = (provides.__module__ + '.' + provides.getName(), provides)
+        )
+
+class IInterfaceDirective(zope.interface.Interface):
+    """
+    Define an interface
+    """
+
+    interface = zope.configuration.fields.GlobalInterface(
+        title=_("Interface"),
+        required=True,
+        )
+
+    type = zope.configuration.fields.GlobalInterface(
+        title=_("Interface type"),
+        required=False,
+        )
+
+    name = zope.schema.TextLine(
+        title=_("Name"),
+        required=False,
+        )
+
+def interface(_context, interface, type=None, name=''):
+    _context.action(
+        discriminator = None,
+        callable = provideInterface,
+        args = (name, interface, type)
+        )


Property changes on: Zope3/branches/jim-adapter/src/zope/component/zcml.py
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: Zope3/branches/jim-adapter/src/zope/i18n/zcml.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/i18n/zcml.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/i18n/zcml.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -25,7 +25,7 @@
 from zope.i18n.testmessagecatalog import TestMessageCatalog
 from zope.i18n.translationdomain import TranslationDomain
 from zope.i18n.interfaces import ITranslationDomain
-from zope.app.component.metaconfigure import utility
+from zope.component.zcml import utility
 
 class IRegisterTranslationsDirective(Interface):
     """Register translations with the global site manager."""

Modified: Zope3/branches/jim-adapter/src/zope/viewlet/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/viewlet/metaconfigure.py	2006-04-11 09:35:09 UTC (rev 66841)
+++ Zope3/branches/jim-adapter/src/zope/viewlet/metaconfigure.py	2006-04-11 10:03:07 UTC (rev 66842)
@@ -24,12 +24,11 @@
 from zope.interface import Interface, classImplements
 from zope.publisher.interfaces.browser import IDefaultBrowserLayer
 from zope.publisher.interfaces.browser import IBrowserView
+from zope.component import zcml
+from zope.viewlet import viewlet, manager, interfaces
 
-from zope.app.component import metaconfigure
 from zope.app.publisher.browser import viewmeta
 
-from zope.viewlet import viewlet, manager, interfaces
-
 def viewletManagerDirective(
     _context, name, permission,
     for_=Interface, layer=IDefaultBrowserLayer, view=IBrowserView,
@@ -80,7 +79,7 @@
 
     # Register interfaces
     viewmeta._handle_for(_context, for_)
-    metaconfigure.interface(_context, view)
+    zcml.interface(_context, view)
 
     # Create a checker for the viewlet manager
     checker.defineChecker(new_class, checker.Checker(required))
@@ -88,7 +87,7 @@
     # register a viewlet manager
     _context.action(
         discriminator = ('viewletManager', for_, layer, view, name),
-        callable = metaconfigure.handler,
+        callable = zcml.handler,
         args = ('provideAdapter',
                 (for_, layer, view), provides, name,
                  new_class, _context.info),)
@@ -176,7 +175,7 @@
 
     # Register the interfaces.
     viewmeta._handle_for(_context, for_)
-    metaconfigure.interface(_context, view)
+    zcml.interface(_context, view)
 
     # Create the security checker for the new class
     checker.defineChecker(new_class, checker.Checker(required))
@@ -184,7 +183,7 @@
     # register viewlet
     _context.action(
         discriminator = ('viewlet', for_, layer, view, manager, name),
-        callable = metaconfigure.handler,
+        callable = zcml.handler,
         args = ('provideAdapter',
                 (for_, layer, view, manager), interfaces.IViewlet,
                  name, new_class, _context.info),)



More information about the Zope3-Checkins mailing list