[Checkins] SVN: grok/trunk/ Merged the brandon-grokcore.component branch.

Philipp von Weitershausen philikon at philikon.de
Thu May 1 07:34:02 EDT 2008


Log message for revision 85991:
  Merged the brandon-grokcore.component branch.
  

Changed:
  U   grok/trunk/setup.py
  U   grok/trunk/src/grok/__init__.py
  U   grok/trunk/src/grok/components.py
  D   grok/trunk/src/grok/decorators.py
  U   grok/trunk/src/grok/directive.py
  U   grok/trunk/src/grok/meta.py
  U   grok/trunk/src/grok/meta.zcml
  U   grok/trunk/src/grok/testing.py
  U   grok/trunk/src/grok/tests/directive/multipletimes.py
  D   grok/trunk/src/grok/tests/order/
  U   grok/trunk/src/grok/tests/test_grok.py
  D   grok/trunk/src/grok/tests/util/public_methods_from_class.py
  U   grok/trunk/src/grok/util.py
  D   grok/trunk/src/grok/zcml.py
  U   grok/trunk/versions.cfg

-=-
Modified: grok/trunk/setup.py
===================================================================
--- grok/trunk/setup.py	2008-05-01 11:32:17 UTC (rev 85990)
+++ grok/trunk/setup.py	2008-05-01 11:34:01 UTC (rev 85991)
@@ -36,6 +36,7 @@
     zip_safe=False,
     install_requires=['setuptools',
                       'martian >= 0.9.3',
+                      'grokcore.component',
                       'simplejson',
                       'pytz',
                       'ZODB3',

Modified: grok/trunk/src/grok/__init__.py
===================================================================
--- grok/trunk/src/grok/__init__.py	2008-05-01 11:32:17 UTC (rev 85990)
+++ grok/trunk/src/grok/__init__.py	2008-05-01 11:34:01 UTC (rev 85991)
@@ -30,10 +30,11 @@
     IContainerModifiedEvent, ContainerModifiedEvent)
 
 from martian import ClassGrokker, InstanceGrokker, GlobalGrokker
-from grok.components import Model, Adapter, MultiAdapter, View
+from grokcore.component import Adapter, MultiAdapter, GlobalUtility
+from grok.components import Model, View
 from grok.components import XMLRPC, REST, JSON
 from grok.components import PageTemplate, PageTemplateFile, Container, Traverser
-from grok.components import Site, GlobalUtility, LocalUtility, Annotation
+from grok.components import Site, LocalUtility, Annotation
 from grok.components import Application, Form, AddForm, EditForm, DisplayForm
 from grok.components import Indexes
 from grok.components import Permission, Role
@@ -42,11 +43,12 @@
 from grok.interfaces import IRESTSkinType
 from grok.components import ViewletManager, Viewlet
 
-from grok.directive import (context, name, title, template, templatedir,
-                            provides, baseclass, global_utility, local_utility,
-                            permissions, require, site, layer, direct, viewletmanager,
-                            view, order)
-from grok.decorators import subscribe, adapter, implementer
+from grokcore.component.directive import (
+    context, name, title, provides, baseclass, global_utility, direct, order)
+from grok.directive import (
+    template, templatedir, local_utility, permissions, require, site,
+    layer, viewletmanager, view)
+from grokcore.component.decorators import subscribe, adapter, implementer
 from martian.error import GrokError, GrokImportError
 
 # BBB These two functions are meant for test fixtures and should be

Modified: grok/trunk/src/grok/components.py
===================================================================
--- grok/trunk/src/grok/components.py	2008-05-01 11:32:17 UTC (rev 85990)
+++ grok/trunk/src/grok/components.py	2008-05-01 11:34:01 UTC (rev 85991)
@@ -50,19 +50,20 @@
 from zope.viewlet.viewlet import ViewletBase
 
 import z3c.flashmessage.interfaces
-
 import martian.util
+import grokcore.component.util
+
 from grok import interfaces, formlib, util
 
 
-class Model(Contained, persistent.Persistent):
+class Model(Contained, persistent.Persistent, grokcore.component.Context):
     # XXX Inheritance order is important here. If we reverse this,
     # then containers can't be models anymore because no unambigous MRO
     # can be established.
     interface.implements(IAttributeAnnotatable)
 
 
-class Container(BTreeContainer):
+class Container(BTreeContainer, grokcore.component.Context):
     interface.implements(IAttributeAnnotatable)
 
 
@@ -84,24 +85,10 @@
     interface.implements(interfaces.IApplication)
 
 
-class Adapter(object):
-
-    def __init__(self, context):
-        self.context = context
-
-
-class GlobalUtility(object):
-    pass
-
-
 class LocalUtility(Model):
     pass
 
 
-class MultiAdapter(object):
-    pass
-
-
 class Annotation(persistent.Persistent):
     pass
 
@@ -631,7 +618,7 @@
         if self.template:
             return self.template.render(self) 
         else:
-            viewlets = util.sort_components(self.viewlets)
+            viewlets = grokcore.component.util.sort_components(self.viewlets)
             return u'\n'.join([viewlet.render() for viewlet in viewlets])
 
     def namespace(self):

Deleted: grok/trunk/src/grok/decorators.py
===================================================================
--- grok/trunk/src/grok/decorators.py	2008-05-01 11:32:17 UTC (rev 85990)
+++ grok/trunk/src/grok/decorators.py	2008-05-01 11:34:01 UTC (rev 85991)
@@ -1,67 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 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.
-#
-##############################################################################
-"""Grok
-"""
-import sys
-import types
-from zope.component._declaration import adapter as _adapter
-from zope.interface.declarations import implementer as _implementer
-from martian.util import frame_is_module
-from martian.error import GrokImportError
-
-class subscribe:
-
-    def __init__(self, *args):
-        self.subscribed = args
-
-    def __call__(self, function):
-        frame = sys._getframe(1)
-        if not frame_is_module(frame):
-            raise GrokImportError("@grok.subscribe can only be used on module "
-                                  "level.")
-
-        if not self.subscribed:
-            raise GrokImportError("@grok.subscribe requires at least one "
-                                  "argument.")
-
-        subscribers = frame.f_locals.get('__grok_subscribers__', None)
-        if subscribers is None:
-            frame.f_locals['__grok_subscribers__'] = subscribers = []
-        subscribers.append((function, self.subscribed))
-        return function
-
-class adapter(_adapter):
-
-    def __init__(self, *interfaces):
-        # Override the z.c.adapter decorator to force sanity checking
-        # and have better error reporting.
-        if not interfaces:
-            raise GrokImportError(
-                "@grok.adapter requires at least one argument.")
-        if type(interfaces[0]) is types.FunctionType:
-            raise GrokImportError(
-                "@grok.adapter requires at least one argument.")
-        self.interfaces = interfaces
-
-class implementer(_implementer):
-
-    def __call__(self, ob):
-        # XXX we do not have function grokkers (yet) so we put the annotation
-        # on the module.
-        frame = sys._getframe(1)
-        implementers = frame.f_locals.get('__implementers__', None)
-        if implementers is None:
-            frame.f_locals['__implementers__'] = implementers = []
-        implementers.append(ob)
-        return _implementer.__call__(self, ob)

Modified: grok/trunk/src/grok/directive.py
===================================================================
--- grok/trunk/src/grok/directive.py	2008-05-01 11:32:17 UTC (rev 85990)
+++ grok/trunk/src/grok/directive.py	2008-05-01 11:34:01 UTC (rev 85991)
@@ -29,34 +29,8 @@
                                ClassDirectiveContext,
                                ClassOrModuleDirectiveContext)
 from martian import util
+from grokcore.component.directive import MultiValueOnceDirective
 
-class GlobalUtilityDirective(MultipleTimesDirective):
-    def check_arguments(self, factory, provides=None, name=u'',
-                        direct=False):
-        if provides is not None and not IInterface.providedBy(provides):
-            raise GrokImportError("You can only pass an interface to the "
-                                  "provides argument of %s." % self.name)
-
-    def value_factory(self, *args, **kw):
-        return GlobalUtilityInfo(*args, **kw)
-
-
-class GlobalUtilityInfo(object):
-    def __init__(self, factory, provides=None, name=u'', direct=None):
-        self.factory = factory
-        if direct is None:
-            direct = util.class_annotation(factory, 'grok.direct', False)
-        self.direct = direct
-
-        if provides is None:
-            provides = util.class_annotation(factory, 'grok.provides', None)
-        self.provides = provides
-
-        if name is u'':
-            name = util.class_annotation(factory, 'grok.name', u'')
-        self.name = name
-
-
 class LocalUtilityDirective(MultipleTimesDirective):
     def check_arguments(self, factory, provides=None, name=u'',
                         setup=None, public=False, name_in_container=None):
@@ -97,49 +71,18 @@
             return func
         return decorator
 
-class MultiValueOnceDirective(OnceDirective):
-
-    def check_arguments(self, *values):
-        pass
-
-    def value_factory(self, *args):
-        return args
-
-class OrderDirective(OptionalValueDirective, OnceDirective):
-
-    order = 0
-
-    def value_factory(self, value=None):
-        OrderDirective.order += 1
-        if value is not None:
-            return value, OrderDirective.order
-        return super(OrderDirective, self).value_factory(value)
-
-    def default_value(self):
-        return 0, OrderDirective.order
-
 # Define grok directives
-name = SingleTextDirective('grok.name', ClassDirectiveContext())
 template = SingleTextDirective('grok.template', ClassDirectiveContext())
-context = InterfaceOrClassDirective('grok.context',
-                                    ClassOrModuleDirectiveContext())
 templatedir = SingleTextDirective('grok.templatedir', ModuleDirectiveContext())
-provides = InterfaceDirective('grok.provides', ClassDirectiveContext())
-baseclass = MarkerDirective('grok.baseclass', ClassDirectiveContext())
-global_utility = GlobalUtilityDirective('grok.global_utility',
-                                        ModuleDirectiveContext())
 local_utility = LocalUtilityDirective('grok.local_utility',
                                       ClassDirectiveContext())
 require = RequireDirective('grok.require', ClassDirectiveContext())
 site = InterfaceOrClassDirective('grok.site',
                                  ClassDirectiveContext())
-title = SingleTextDirective('grok.title', ClassDirectiveContext())
 permissions = MultiValueOnceDirective(
     'grok.permissions', ClassDirectiveContext())
 layer = InterfaceOrClassDirective('grok.layer',
                            ClassOrModuleDirectiveContext())
-order = OrderDirective('grok.order', ClassDirectiveContext())
-direct = MarkerDirective('grok.direct', ClassDirectiveContext())
 viewletmanager = InterfaceOrClassDirective('grok.viewletmanager',
                                            ClassOrModuleDirectiveContext())
 view = InterfaceOrClassDirective('grok.view',

Modified: grok/trunk/src/grok/meta.py
===================================================================
--- grok/trunk/src/grok/meta.py	2008-05-01 11:32:17 UTC (rev 85990)
+++ grok/trunk/src/grok/meta.py	2008-05-01 11:34:01 UTC (rev 85991)
@@ -50,45 +50,21 @@
 
 import grok
 from grok import components, formlib, templatereg
-from grok.util import check_adapts, get_default_permission
-from grok.util import check_permission, make_checker
-from grok.util import check_module_component, determine_module_component
-from grok.util import determine_class_component
-from grok.util import determine_class_directive, public_methods_from_class
+from grok.util import check_permission, get_default_permission, make_checker
 from grok.rest import RestPublisher
 from grok.interfaces import IRESTSkinType
 
-def get_context(module_info, factory):
-    return determine_class_component(module_info, factory,
-                                     'context', 'grok.context')
+from grokcore.component.meta import get_context, get_name, get_name_classname
+from grokcore.component.util import check_adapts
+from grokcore.component.util import determine_class_component
+from grokcore.component.util import determine_class_directive
+from grokcore.component.util import determine_module_component
+from grokcore.component.util import public_methods_from_class
 
 def get_viewletmanager(module_info, factory):
     return determine_class_component(module_info, factory,
                                      'viewletmanager', 'grok.viewletmanager')
 
-def get_name_classname(factory):
-    return get_name(factory, factory.__name__.lower())
-
-def get_name(factory, default=''):
-    return grok.util.class_annotation(factory, 'grok.name', default)
-
-def get_provides(factory):
-    provides = util.class_annotation(factory, 'grok.provides', None)
-    if provides is None:
-        util.check_implements_one(factory)
-    return provides
-
-class ContextGrokker(martian.GlobalGrokker):
-
-    priority = 1001
-
-    def grok(self, name, module, module_info, config, **kw):
-        context = determine_module_component(module_info, 'grok.context',
-                                             [grok.Model, grok.Container])
-        module.__grok_context__ = context
-        return True
-
-
 class ViewletManagerContextGrokker(martian.GlobalGrokker):
 
     priority = 1001
@@ -100,61 +76,6 @@
         module.__grok_viewletmanager__ = viewletmanager
         return True
 
-class AdapterGrokker(martian.ClassGrokker):
-    component_class = grok.Adapter
-
-    def grok(self, name, factory, module_info, config, **kw):
-        adapter_context = get_context(module_info, factory)
-        provides = get_provides(factory)
-        name = get_name(factory)
-
-        config.action(
-            discriminator=('adapter', adapter_context, provides, name),
-            callable=component.provideAdapter,
-            args=(factory, (adapter_context,), provides, name),
-            )
-        return True
-
-class MultiAdapterGrokker(martian.ClassGrokker):
-    component_class = grok.MultiAdapter
-
-    def grok(self, name, factory, module_info, config, **kw):
-        provides = get_provides(factory)
-        name = get_name(factory)
-
-        check_adapts(factory)
-        for_ = component.adaptedBy(factory)
-
-        config.action(
-            discriminator=('adapter', for_, provides, name),
-            callable=component.provideAdapter,
-            args=(factory, None, provides, name),
-            )
-        return True
-
-
-class GlobalUtilityGrokker(martian.ClassGrokker):
-    component_class = grok.GlobalUtility
-
-    # This needs to happen before the FilesystemPageTemplateGrokker grokker
-    # happens, since it relies on the ITemplateFileFactories being grokked.
-    priority = 1100
-
-    def grok(self, name, factory, module_info, config, **kw):
-        provides = get_provides(factory)
-        name = get_name(factory)
-
-        direct = util.class_annotation(factory, 'grok.direct', False)
-        if not direct:
-            factory = factory()
-
-        config.action(
-            discriminator=('utility', provides, name),
-            callable=component.provideUtility,
-            args=(factory, provides, name),
-            )
-        return True
-
 class XMLRPCGrokker(martian.ClassGrokker):
     component_class = grok.XMLRPC
 
@@ -470,49 +391,6 @@
         return True
 
 
-class SubscriberGrokker(martian.GlobalGrokker):
-
-    def grok(self, name, module, module_info, config, **kw):
-        subscribers = module_info.getAnnotation('grok.subscribers', [])
-
-        for factory, subscribed in subscribers:
-            config.action(
-                discriminator=None,
-                callable=component.provideHandler,
-                args=(factory, subscribed),
-                )
-
-            for iface in subscribed:
-                config.action(
-                    discriminator=None,
-                    callable=zope.component.interface.provideInterface,
-                    args=('', iface)
-                    )
-        return True
-
-
-class AdapterDecoratorGrokker(martian.GlobalGrokker):
-
-    def grok(self, name, module, module_info, config, **kw):
-        context = module_info.getAnnotation('grok.context', None)
-        implementers = module_info.getAnnotation('implementers', [])
-        for function in implementers:
-            interfaces = getattr(function, '__component_adapts__', None)
-            if interfaces is None:
-                # There's no explicit interfaces defined, so we assume the
-                # module context to be the thing adapted.
-                check_module_component(module_info.getModule(), context,
-                                       'context', 'grok.context')
-                interfaces = (context, )
-
-            config.action(
-                discriminator=('adapter', interfaces, function.__implemented__),
-                callable=component.provideAdapter,
-                args=(function, interfaces, function.__implemented__),
-                )
-        return True
-
-
 class StaticResourcesGrokker(martian.GlobalGrokker):
 
     def grok(self, name, module, module_info, config, **kw):
@@ -549,24 +427,6 @@
         return True
 
 
-class GlobalUtilityDirectiveGrokker(martian.GlobalGrokker):
-
-    def grok(self, name, module, module_info, config, **kw):
-        infos = module_info.getAnnotation('grok.global_utility', [])
-
-        for info in infos:
-            if info.provides is None:
-                util.check_implements_one(info.factory)
-            if info.direct:
-                obj = info.factory
-            else:
-                obj = info.factory()
-            component.provideUtility(obj,
-                                     provides=info.provides,
-                                     name=info.name)
-        return True
-
-
 class SiteGrokker(martian.ClassGrokker):
     component_class = grok.Site
     priority = 500

Modified: grok/trunk/src/grok/meta.zcml
===================================================================
--- grok/trunk/src/grok/meta.zcml	2008-05-01 11:32:17 UTC (rev 85990)
+++ grok/trunk/src/grok/meta.zcml	2008-05-01 11:34:01 UTC (rev 85991)
@@ -5,15 +5,8 @@
 
   <include package="z3c.autoinclude" file="meta.zcml" />
 
-  <meta:directives namespace="http://namespaces.zope.org/grok">
-    <meta:directive
-        name="grok"
-        schema=".zcml.IGrokDirective"
-        handler=".zcml.grokDirective"
-        />
-  </meta:directives>
-
   <!-- Load the grokkers -->
+  <include package="grokcore.component" file="meta.zcml" />
   <grok:grok package=".meta" />
 
 </configure>

Modified: grok/trunk/src/grok/testing.py
===================================================================
--- grok/trunk/src/grok/testing.py	2008-05-01 11:32:17 UTC (rev 85990)
+++ grok/trunk/src/grok/testing.py	2008-05-01 11:34:01 UTC (rev 85991)
@@ -15,7 +15,7 @@
 """
 from zope.configuration.config import ConfigurationMachine
 from martian import scan
-from grok import zcml
+from grokcore.component import zcml
 import z3c.testsetup
 import os.path
 
@@ -39,6 +39,7 @@
 
 def grok(module_name):
     config = ConfigurationMachine()
+    zcml.do_grok('grokcore.component.meta', config)
     zcml.do_grok('grok.meta', config)
     zcml.do_grok('grok.templatereg', config)
     zcml.do_grok(module_name, config)

Modified: grok/trunk/src/grok/tests/directive/multipletimes.py
===================================================================
--- grok/trunk/src/grok/tests/directive/multipletimes.py	2008-05-01 11:32:17 UTC (rev 85990)
+++ grok/trunk/src/grok/tests/directive/multipletimes.py	2008-05-01 11:34:01 UTC (rev 85991)
@@ -7,8 +7,8 @@
   >>> module_info = scan.module_info_from_module(multipletimes)
   >>> guis = module_info.getAnnotation('grok.global_utility', None)
   >>> guis
-  [<grok.directive.GlobalUtilityInfo object at 0x...>,
-  <grok.directive.GlobalUtilityInfo object at 0x...>]
+  [<grokcore.component.directive.GlobalUtilityInfo object at 0x...>,
+   <grokcore.component.directive.GlobalUtilityInfo object at 0x...>]
   >>> guis[0].factory
   <class 'grok.tests.directive.multipletimes.Club'>
   >>> guis[0].provides

Modified: grok/trunk/src/grok/tests/test_grok.py
===================================================================
--- grok/trunk/src/grok/tests/test_grok.py	2008-05-01 11:32:17 UTC (rev 85990)
+++ grok/trunk/src/grok/tests/test_grok.py	2008-05-01 11:34:01 UTC (rev 85991)
@@ -45,7 +45,7 @@
     for name in ['adapter', 'error', 'view', 'event', 'security', 'catalog',
                  'zcml', 'static', 'utility', 'xmlrpc', 'json', 'container',
                  'traversal', 'form', 'grokker', 'directive', 'util',
-                 'baseclass', 'annotation', 'application', 'template', 'order',
+                 'baseclass', 'annotation', 'application', 'template',
                  'viewlet', 'testsetup', 'conflict']:
         suite.addTest(suiteFromPackage(name))
     return suite

Deleted: grok/trunk/src/grok/tests/util/public_methods_from_class.py
===================================================================
--- grok/trunk/src/grok/tests/util/public_methods_from_class.py	2008-05-01 11:32:17 UTC (rev 85990)
+++ grok/trunk/src/grok/tests/util/public_methods_from_class.py	2008-05-01 11:34:01 UTC (rev 85991)
@@ -1,28 +0,0 @@
-"""
-  >>> methods = grok.util.public_methods_from_class(A)
-  >>> sorted([m.__name__ for m in methods])
-  ['should_also_be_public', 'should_be_public']
-
-"""
-import grok
-import grok.util
-
-class A(object):
-
-    def __init__(self):
-        pass # this method is ignored
-
-    def __call__(self):
-        pass # this method is ignored
-
-    def __double_underscored(self):
-        pass # this method is ignored
-
-    def _single_underscored(self):
-        pass # this method is ignored
-
-    def should_be_public(self):
-        pass # this method is found
-
-    def should_also_be_public(self):
-        pass # this method is found

Modified: grok/trunk/src/grok/util.py
===================================================================
--- grok/trunk/src/grok/util.py	2008-05-01 11:32:17 UTC (rev 85990)
+++ grok/trunk/src/grok/util.py	2008-05-01 11:34:01 UTC (rev 85991)
@@ -25,15 +25,9 @@
 from zope.security.checker import NamesChecker, defineChecker
 from zope.security.interfaces import IPermission
 
-from martian.error import GrokError, GrokImportError
-from martian.util import class_annotation, methods_from_class, scan_for_classes
+from martian.error import GrokError
+from martian.util import class_annotation
 
-def check_adapts(class_):
-    if component.adaptedBy(class_) is None:
-        raise GrokError("%r must specify which contexts it adapts "
-                        "(use grok.adapts to specify)."
-                        % class_, class_)
-
 def make_checker(factory, view_factory, permission, method_names=None):
     """Make a checker for a view_factory associated with factory.
 
@@ -100,96 +94,6 @@
     # This either sets __parent__ or wraps 'obj' in a LocationProxy
     return zope.location.location.located(obj, parent, name)
 
-def determine_class_directive(directive_name, factory, module_info,
-                              default=None):
-    directive = class_annotation(factory, directive_name, None)
-    if directive is None:
-        directive = module_info.getAnnotation(directive_name, None)
-    if directive is not None:
-        return directive
-    return default
-
-def public_methods_from_class(factory):
-    return [m for m in methods_from_class(factory) if \
-            not m.__name__.startswith('_')]
-
-def _sort_key(component):
-    explicit_order, implicit_order = class_annotation(component,
-                                                      'grok.order',
-                                                      (0,0))
-    return (explicit_order,
-            component.__module__,
-            implicit_order,
-            component.__class__.__name__)
-
-def sort_components(components):
-    # if components have a grok.order directive, sort by that
-    return sorted(components, key=_sort_key)
-
-AMBIGUOUS_COMPONENT = object()
-def check_module_component(factory, component,
-                           component_name, component_directive):
-    """Raise error if module-level component cannot be determined.
-
-    If the module-level component is None, it's never been specified;
-    raise error telling developer to specify.
-
-    if the module-level component is AMBIGUOUS_COMPONENT, raise
-    an error telling developer to specify which one to use.
-    """
-    if component is None:
-        raise GrokError("No module-level %s for %r, please use "
-                        "%s." % (component_name, factory, component_directive),
-                        factory)
-    elif component is AMBIGUOUS_COMPONENT:
-        raise GrokError("Multiple possible %ss for %r, please use "
-                        "%s." % (component_name, factory, component_directive),
-                        factory)
-    
-def determine_module_component(module_info, annotation, classes):
-    """Determine module-level component.
-
-    The module-level component can be set explicitly using the
-    annotation (such as grok.context).
-
-    If there is no annotation, the module-level component is determined
-    by scanning for subclasses of any in the list of classes.
-
-    If there is no module-level component, the module-level component is
-    None.
-
-    If there is one module-level component, it is returned.
-
-    If there are more than one module-level component, AMBIGUOUS_COMPONENT
-    is returned.
-    """
-    components = scan_for_classes(module_info.getModule(), classes)
-    if len(components) == 0:
-        component = None
-    elif len(components) == 1:
-        component = components[0]
-    else:
-        component= AMBIGUOUS_COMPONENT
-        
-    module_component = module_info.getAnnotation(annotation, None)
-    if module_component:
-        component = module_component
-    return component
-
-
-def determine_class_component(module_info, class_,
-                              component_name, component_directive):
-    """Determine component for a class.
-
-    Determine a component for a class. If no class-specific component exists,
-    try falling back on module-level component.
-    """
-    module_component = module_info.getAnnotation(component_directive, None)
-    component = class_annotation(class_, component_directive, module_component)
-    check_module_component(class_, component,
-                           component_name, component_directive)
-    return component
-
 def applySkin(request, skin, skin_type):
     """Change the presentation skin for this request.
     """
@@ -199,4 +103,3 @@
     # Add the new skin.
     ifaces.append(skin)
     interface.directlyProvides(request, *ifaces)
-

Deleted: grok/trunk/src/grok/zcml.py
===================================================================
--- grok/trunk/src/grok/zcml.py	2008-05-01 11:32:17 UTC (rev 85990)
+++ grok/trunk/src/grok/zcml.py	2008-05-01 11:34:01 UTC (rev 85991)
@@ -1,54 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006-2007 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.
-#
-##############################################################################
-"""Grok ZCML directives."""
-
-from zope.interface import Interface
-from zope.configuration.fields import GlobalObject
-from zope.configuration.config import ConfigurationMachine
-
-import martian
-from martian import scan
-from martian.error import GrokError
-
-class IGrokDirective(Interface):
-    """Grok a package or module."""
-
-    package = GlobalObject(
-        title=u"Package",
-        description=u"The package or module to be analyzed by grok.",
-        required=False,
-        )
-
-# add a cleanup hook so that grok will bootstrap itself again whenever
-# the Component Architecture is torn down.
-def resetBootstrap():
-    # we need to make sure that the grokker registry is clean again
-    the_module_grokker.clear()
-from zope.testing.cleanup import addCleanUp
-addCleanUp(resetBootstrap)
-
-the_multi_grokker = martian.MetaMultiGrokker()
-the_module_grokker = martian.ModuleGrokker(the_multi_grokker)
-
-def skip_tests(name):
-    return name in ['tests', 'ftests']
-
-def grokDirective(_context, package):
-    do_grok(package.__name__, _context)
-
-def do_grok(dotted_name, config):
-    martian.grok_dotted_name(
-        dotted_name, the_module_grokker, exclude_filter=skip_tests,
-        config=config
-        )

Modified: grok/trunk/versions.cfg
===================================================================
--- grok/trunk/versions.cfg	2008-05-01 11:32:17 UTC (rev 85990)
+++ grok/trunk/versions.cfg	2008-05-01 11:34:01 UTC (rev 85991)
@@ -6,6 +6,7 @@
 ZODB3 = 3.8
 docutils = 0.4
 martian = 0.9.3
+grokcore.component = 1.0
 mechanize = 0.1.7b
 pytz = 2007k
 simplejson = 1.7.1



More information about the Checkins mailing list