[Checkins] SVN: zope.app.component/trunk/ move over zope:resource and zope:view directive implementations into

Martijn Faassen faassen at startifact.com
Thu May 21 09:20:47 EDT 2009


Log message for revision 100191:
  move over zope:resource and zope:view directive implementations into
  zope.component.
  

Changed:
  U   zope.app.component/trunk/CHANGES.txt
  U   zope.app.component/trunk/buildout.cfg
  U   zope.app.component/trunk/setup.py
  U   zope.app.component/trunk/src/zope/app/component/meta.zcml
  U   zope.app.component/trunk/src/zope/app/component/metaconfigure.py
  U   zope.app.component/trunk/src/zope/app/component/metadirectives.py
  U   zope.app.component/trunk/src/zope/app/component/tests/test_directives.py

-=-
Modified: zope.app.component/trunk/CHANGES.txt
===================================================================
--- zope.app.component/trunk/CHANGES.txt	2009-05-21 13:18:29 UTC (rev 100190)
+++ zope.app.component/trunk/CHANGES.txt	2009-05-21 13:20:47 UTC (rev 100191)
@@ -7,9 +7,13 @@
 
 - zope.app.security was only a testing dependency so made it such.
 
-- zope.componentvocabulary has the vocabulary implementations now,
-  import them from there for backwards compatibility.
+- zope.componentvocabulary has the vocabulary implementations that
+  were in zope.app.componentvocabulary now, import them from there for
+  backwards compatibility.
 
+- moved zope:resource and zope:view directive implementation and tests  
+  over into zope.component [zcml].
+
 3.7.0 (2009-04-01)
 ------------------
 

Modified: zope.app.component/trunk/buildout.cfg
===================================================================
--- zope.app.component/trunk/buildout.cfg	2009-05-21 13:18:29 UTC (rev 100190)
+++ zope.app.component/trunk/buildout.cfg	2009-05-21 13:20:47 UTC (rev 100191)
@@ -1,5 +1,5 @@
 [buildout]
-develop = .
+develop = . ../zope.component ../zope.app.interface
 parts = test coverage-test coverage-report
 
 [test]

Modified: zope.app.component/trunk/setup.py
===================================================================
--- zope.app.component/trunk/setup.py	2009-05-21 13:18:29 UTC (rev 100190)
+++ zope.app.component/trunk/setup.py	2009-05-21 13:20:47 UTC (rev 100191)
@@ -56,10 +56,11 @@
                 'zope.app.zcmlfiles',
                 'zope.app.schema',
                 'zope.testbrowser',
-                'zope.app.security',
+               # 'zope.app.security',
                 ]),
       install_requires=[
           'setuptools',
+          'zope.app.security',
           'zope.site',
           'zope.annotation',
           'zope.app.container',

Modified: zope.app.component/trunk/src/zope/app/component/meta.zcml
===================================================================
--- zope.app.component/trunk/src/zope/app/component/meta.zcml	2009-05-21 13:18:29 UTC (rev 100190)
+++ zope.app.component/trunk/src/zope/app/component/meta.zcml	2009-05-21 13:20:47 UTC (rev 100191)
@@ -8,20 +8,4 @@
        moved from here. -->
   <include package="zope.security" file="meta.zcml" />
 
-  <meta:directives namespace="http://namespaces.zope.org/zope">
-
-    <meta:directive
-        name="view"
-        schema=".metadirectives.IViewDirective"
-        handler="zope.app.component.metaconfigure.view"
-        />
-
-    <meta:directive
-        name="resource"
-        schema=".metadirectives.IResourceDirective"
-        handler="zope.app.component.metaconfigure.resource"
-        />
-
-  </meta:directives>
-
 </configure>

Modified: zope.app.component/trunk/src/zope/app/component/metaconfigure.py
===================================================================
--- zope.app.component/trunk/src/zope/app/component/metaconfigure.py	2009-05-21 13:18:29 UTC (rev 100190)
+++ zope.app.component/trunk/src/zope/app/component/metaconfigure.py	2009-05-21 13:20:47 UTC (rev 100191)
@@ -11,173 +11,5 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Generic Components ZCML Handlers
-
-$Id$
-"""
-__docformat__ = 'restructuredtext'
-
-import warnings
-from zope.interface import Interface
-from zope.component.zcml import handler, proxify
-from zope.component.interface import provideInterface
-from zope.configuration.exceptions import ConfigurationError
-from zope.security.checker import CheckerPublic
-from zope.security.checker import Checker
-
-PublicPermission = 'zope.Public'
-
-def _checker(_context, permission, allowed_interface, allowed_attributes):
-    if (not allowed_attributes) and (not allowed_interface):
-        allowed_attributes = ["__call__"]
-
-    if permission == PublicPermission:
-        permission = CheckerPublic
-
-    require={}
-    if allowed_attributes:
-        for name in allowed_attributes:
-            require[name] = permission
-    if allowed_interface:
-        for i in allowed_interface:
-            for name in i.names(all=True):
-                require[name] = permission
-
-    checker = Checker(require)
-    return checker
-
-def resource(_context, factory, type, name, layer=None,
-             permission=None,
-             allowed_interface=None, allowed_attributes=None,
-             provides=Interface):
-
-    if ((allowed_attributes or allowed_interface)
-        and (not permission)):
-        raise ConfigurationError(
-            "Must use name attribute with allowed_interface or "
-            "allowed_attributes"
-            )
-
-    if permission:
-        checker = _checker(_context, permission,
-                           allowed_interface, allowed_attributes)
-
-        def proxyResource(request, factory=factory, checker=checker):
-            return proxify(factory(request), checker)
-
-        factory = proxyResource
-
-    if layer is not None:
-        warnings.warn_explicit(
-            "The 'layer' argument of the 'resource' directive has been "
-            "deprecated.  Use the 'type' argument instead.",
-            DeprecationWarning, _context.info.file, _context.info.line)
-        type = layer
-
-    _context.action(
-        discriminator = ('resource', name, type, provides),
-        callable = handler,
-        args = ('registerAdapter',
-                factory, (type,), provides, name, _context.info),
-        )
-    _context.action(
-        discriminator = None,
-        callable = provideInterface,
-        args = (type.__module__ + '.' + type.__name__, type)
-               )
-    _context.action(
-        discriminator = None,
-        callable = provideInterface,
-        args = (provides.__module__ + '.' + provides.__name__, type)
-               )
-
-def view(_context, factory, type, name, for_, layer=None,
-         permission=None, allowed_interface=None, allowed_attributes=None,
-         provides=Interface):
-
-    if ((allowed_attributes or allowed_interface)
-        and (not permission)):
-        raise ConfigurationError(
-            "Must use name attribute with allowed_interface or "
-            "allowed_attributes"
-            )
-
-    if not factory:
-        raise ConfigurationError("No view factory specified.")
-
-    if permission:
-
-        checker = _checker(_context, permission,
-                           allowed_interface, allowed_attributes)
-
-        class ProxyView(object):
-            """Class to create simple proxy views."""
-
-            def __init__(self, factory, checker):
-                self.factory = factory
-                self.checker = checker
-
-            def __call__(self, *objects):
-                return proxify(self.factory(*objects), self.checker)
-
-        factory[-1] = ProxyView(factory[-1], checker)
-
-
-    if not for_:
-        raise ValueError("No for interfaces specified");
-    for_ = tuple(for_)
-
-    # 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:
-        def factory(ob, request):
-            for f in factories[:-1]:
-                ob = f(ob)
-            return factories[-1](ob, request)
-
-    # BBB 2006/02/18, to be removed after 12 months
-    if layer is not None:
-        for_ = for_ + (layer,)
-        warnings.warn_explicit(
-            "The 'layer' argument of the 'view' directive has been "
-            "deprecated.  Use the 'type' argument instead. If you have "
-            "an existing 'type' argument IBrowserRequest, replace it with the "
-            "'layer' argument (the layer subclasses IBrowserRequest). "
-            "which subclasses BrowserRequest.",
-            DeprecationWarning, _context.info.file, _context.info.line)
-    else:
-        for_ = for_ + (type,)
-
-    _context.action(
-        discriminator = ('view', for_, name, provides),
-        callable = handler,
-        args = ('registerAdapter',
-                factory, for_, provides, name, _context.info),
-        )
-    if type is not None:
-        _context.action(
-            discriminator = None,
-            callable = provideInterface,
-            args = ('', type)
-            )
-
-    _context.action(
-        discriminator = None,
-        callable = provideInterface,
-        args = ('', provides)
-        )
-
-    if for_ is not None:
-        for iface in for_:
-            if iface is not None:
-                _context.action(
-                    discriminator = None,
-                    callable = provideInterface,
-                    args = ('', iface)
-                    )
+# BBB
+from zope.component.zcml import PublicPermission, _checker, view, resource

Modified: zope.app.component/trunk/src/zope/app/component/metadirectives.py
===================================================================
--- zope.app.component/trunk/src/zope/app/component/metadirectives.py	2009-05-21 13:18:29 UTC (rev 100190)
+++ zope.app.component/trunk/src/zope/app/component/metadirectives.py	2009-05-21 13:20:47 UTC (rev 100191)
@@ -11,21 +11,9 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Component architecture related 'zope' ZCML namespace directive interfaces
 
-$Id$
-"""
-__docformat__ = 'restructuredtext'
+import zope.security
 
-import zope.configuration.fields
-import zope.deferredimport
-import zope.security.zcml
-import zope.interface
-import zope.schema
-from zope.component.zcml import IBasicComponentInformation
-
-from zope.app.component.i18n import ZopeMessageFactory as _
-
 # BBB
 zope.deferredimport.deprecatedFrom(
     "Schemas for the ``class`` directive and its subdirectives are now "
@@ -41,121 +29,8 @@
     'IFactorySubdirective',
 )
 
-class IBasicViewInformation(zope.interface.Interface):
-    """This is the basic information for all views."""
-
-    for_ = zope.configuration.fields.Tokens(
-        title=_("Specifications of the objects to be viewed"),
-        description=_("""This should be a list of interfaces or classes
-        """),
-        required=True,
-        value_type=zope.configuration.fields.GlobalObject(
-          missing_value=object(),
-          ),
-        )
-
-    permission = zope.security.zcml.Permission(
-        title=_("Permission"),
-        description=_("The permission needed to use the view."),
-        required=False,
-        )
-
-    class_ = zope.configuration.fields.GlobalObject(
-        title=_("Class"),
-        description=_("A class that provides attributes used by the view."),
-        required=False,
-        )
-
-    layer = zope.configuration.fields.GlobalInterface(
-        title=_("The layer the view is in."),
-        description=_("""
-        A skin is composed of layers. It is common to put skin
-        specific views in a layer named after the skin. If the 'layer'
-        attribute is not supplied, it defaults to 'default'."""),
-        required=False,
-        )
-
-    allowed_interface = zope.configuration.fields.Tokens(
-        title=_("Interface that is also allowed if user has permission."),
-        description=_("""
-        By default, 'permission' only applies to viewing the view and
-        any possible sub views. By specifying this attribute, you can
-        make the permission also apply to everything described in the
-        supplied interface.
-
-        Multiple interfaces can be provided, separated by
-        whitespace."""),
-        required=False,
-        value_type=zope.configuration.fields.GlobalInterface(),
-        )
-
-    allowed_attributes = zope.configuration.fields.Tokens(
-        title=_("View attributes that are also allowed if the user"
-                " has permission."),
-        description=_("""
-        By default, 'permission' only applies to viewing the view and
-        any possible sub views. By specifying 'allowed_attributes',
-        you can make the permission also apply to the extra attributes
-        on the view object."""),
-        required=False,
-        value_type=zope.configuration.fields.PythonIdentifier(),
-        )
-
-class IBasicResourceInformation(zope.interface.Interface):
-    """
-    Basic information for resources
-    """
-
-    name = zope.schema.TextLine(
-        title=_("The name of the resource."),
-        description=_("The name shows up in URLs/paths. For example 'foo'."),
-        required=True,
-        default=u'',
-        )
-
-    provides = zope.configuration.fields.GlobalInterface(
-        title=_("The interface this component provides."),
-        description=_("""
-        A view can provide an interface.  This would be used for
-        views that support other views."""),
-        required=False,
-        default=zope.interface.Interface,
-        )
-
-    type = zope.configuration.fields.GlobalInterface(
-        title=_("Request type"),
-        required=True
-        )
-
-
-class IViewDirective(IBasicViewInformation, IBasicResourceInformation):
-    """Register a view for a component"""
-
-    factory = zope.configuration.fields.Tokens(
-        title=_("Factory"),
-        required=False,
-        value_type=zope.configuration.fields.GlobalObject(),
-        )
-
-
-class IResourceDirective(IBasicComponentInformation,
-                         IBasicResourceInformation):
-    """Register a resource"""
-
-    layer = zope.configuration.fields.GlobalInterface(
-        title=_("The layer the resource is in."),
-        required=False,
-        )
-
-    allowed_interface = zope.configuration.fields.Tokens(
-        title=_("Interface that is also allowed if user has permission."),
-        required=False,
-        value_type=zope.configuration.fields.GlobalInterface(),
-        )
-
-    allowed_attributes = zope.configuration.fields.Tokens(
-        title=_("View attributes that are also allowed if user"
-                " has permission."),
-        required=False,
-        value_type=zope.configuration.fields.PythonIdentifier(),
-        )
+# BBB
+from zope.component.zcml import (IBasicViewInformation,
+                                 IBasicResourceInformation,
+                                 IViewDirective,
+                                 IResourceDirective)

Modified: zope.app.component/trunk/src/zope/app/component/tests/test_directives.py
===================================================================
--- zope.app.component/trunk/src/zope/app/component/tests/test_directives.py	2009-05-21 13:18:29 UTC (rev 100190)
+++ zope.app.component/trunk/src/zope/app/component/tests/test_directives.py	2009-05-21 13:20:47 UTC (rev 100191)
@@ -76,393 +76,7 @@
     XMLConfig('meta.zcml', zope.app.component)()
 
 
-class Test(PlacelessSetup, unittest.TestCase):
 
-    def setUp(self):
-        super(Test, self).setUp()
-        XMLConfig('meta.zcml', zope.app.component)()
-        XMLConfig('meta.zcml', zope.app.security)()
-
-    def testView(self):
-        ob = Ob()
-        request = Request(IV)
-        self.assertEqual(
-            zope.component.queryMultiAdapter((ob, request), name=u'test'), None)
-
-        xmlconfig(StringIO(template %
-            '''
-            <view name="test"
-                  factory="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  type="zope.app.component.tests.views.IV"/>
-            '''
-            ))
-
-        self.assertEqual(
-            zope.component.queryMultiAdapter((ob, request),
-                                             name=u'test').__class__,
-            V1)
-
-
-    def testMultiView(self):
-        xmlconfig(StringIO(template %
-            '''
-            <view name="test"
-                  factory="zope.app.component.tests.adapter.A3"
-                  for="zope.app.component.tests.views.IC
-                       zope.app.component.tests.adapter.I1
-                       zope.app.component.tests.adapter.I2"
-                  type="zope.app.component.tests.views.IV"/>
-            '''
-            ))
-
-
-        ob = Ob()
-        a1 = A1()
-        a2 = A2()
-        request = Request(IV)
-        view = zope.component.queryMultiAdapter((ob, a1, a2, request),
-                                                name=u'test')
-        self.assertEqual(view.__class__, A3)
-        self.assertEqual(view.context, (ob, a1, a2, request))
-
-
-    def testMultiView_fails_w_multiple_factories(self):
-        self.assertRaises(
-            ConfigurationError,
-            xmlconfig,
-            StringIO(template %
-              '''
-              <view name="test"
-                    factory="zope.app.component.tests.adapter.A3
-                             zope.app.component.tests.adapter.A2"
-                    for="zope.app.component.tests.views.IC
-                         zope.app.component.tests.adapter.I1
-                         zope.app.component.tests.adapter.I2"
-                    type="zope.app.component.tests.views.IV"/>
-              '''
-              )
-            )
-
-    def testView_w_multiple_factories(self):
-        xmlconfig(StringIO(template %
-            '''
-            <view name="test"
-                  factory="zope.app.component.tests.adapter.A1
-                           zope.app.component.tests.adapter.A2
-                           zope.app.component.tests.adapter.A3
-                           zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  type="zope.app.component.tests.views.IV"/>
-            '''
-            ))
-
-        ob = Ob()
-
-        # The view should be a V1 around an A3, around an A2, around
-        # an A1, anround ob:
-        view = zope.component.queryMultiAdapter((ob, Request(IV)), name=u'test')
-        self.assertEqual(view.__class__, V1)
-        a3 = view.context
-        self.assertEqual(a3.__class__, A3)
-        a2 = a3.context[0]
-        self.assertEqual(a2.__class__, A2)
-        a1 = a2.context[0]
-        self.assertEqual(a1.__class__, A1)
-        self.assertEqual(a1.context[0], ob)
-
-    def testView_fails_w_no_factories(self):
-        self.assertRaises(ConfigurationError,
-                          xmlconfig,
-                          StringIO(template %
-                                   '''
-                                   <view name="test"
-                                   factory=""
-                                   for="zope.app.component.tests.views.IC"
-                                   type="zope.app.component.tests.views.IV"/>
-                                   '''
-                                   ),
-                          )
-
-
-    def testViewThatProvidesAnInterface(self):
-        ob = Ob()
-        self.assertEqual(
-            zope.component.queryMultiAdapter((ob, Request(IR)), IV, u'test'),
-            None)
-
-        xmlconfig(StringIO(template %
-            '''
-            <view name="test"
-                  factory="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  type="zope.app.component.tests.views.IR"
-                  />
-            '''
-            ))
-
-        self.assertEqual(
-            zope.component.queryMultiAdapter((ob, Request(IR)), IV, u'test'),
-            None)
-
-        xmlconfig(StringIO(template %
-            '''
-            <view name="test"
-                  factory="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  type="zope.app.component.tests.views.IR"
-                  provides="zope.app.component.tests.views.IV"
-                  />
-            '''
-            ))
-
-        v = zope.component.queryMultiAdapter((ob, Request(IR)), IV, u'test')
-        self.assertEqual(v.__class__, V1)
-
-
-    def testUnnamedViewThatProvidesAnInterface(self):
-        ob = Ob()
-        self.assertEqual(
-            zope.component.queryMultiAdapter((ob, Request(IR)), IV), None)
-
-        xmlconfig(StringIO(template %
-            '''
-            <view factory="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  type="zope.app.component.tests.views.IR"
-                  />
-            '''
-            ))
-
-        v = zope.component.queryMultiAdapter((ob, Request(IR)), IV)
-        self.assertEqual(v, None)
-
-        xmlconfig(StringIO(template %
-            '''
-            <view factory="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  type="zope.app.component.tests.views.IR"
-                  provides="zope.app.component.tests.views.IV"
-                  />
-            '''
-            ))
-
-        v = zope.component.queryMultiAdapter((ob, Request(IR)), IV)
-        self.assertEqual(v.__class__, V1)
-
-    def testViewHavingARequiredClass(self):
-        xmlconfig(StringIO(template % (
-            '''
-            <view
-              for="zope.app.component.tests.components.Content"
-              type="zope.app.component.tests.views.IR"
-              factory="zope.app.component.tests.adapter.A1"
-              />
-            '''
-            )))
-
-        content = Content()
-        a1 = zope.component.getMultiAdapter((content, Request(IR)))
-        self.assert_(isinstance(a1, A1))
-
-        class MyContent:
-            implements(IContent)
-
-        self.assertRaises(ComponentLookupError, zope.component.getMultiAdapter,
-                          (MyContent(), Request(IR)))
-
-    def testInterfaceProtectedView(self):
-        xmlconfig(StringIO(template %
-            '''
-            <view name="test"
-                  factory="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  type="zope.app.component.tests.views.IV"
-                  permission="zope.Public"
-              allowed_interface="zope.app.component.tests.views.IV"
-                  />
-            '''
-            ))
-
-        v = ProxyFactory(zope.component.getMultiAdapter((Ob(), Request(IV)),
-                                                        name='test'))
-        self.assertEqual(v.index(), 'V1 here')
-        self.assertRaises(Exception, getattr, v, 'action')
-
-    def testAttributeProtectedView(self):
-        xmlconfig(StringIO(template %
-            '''
-            <view name="test"
-                  factory="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  type="zope.app.component.tests.views.IV"
-                  permission="zope.Public"
-                  allowed_attributes="action"
-                  />
-            '''
-            ))
-
-        v = ProxyFactory(zope.component.getMultiAdapter((Ob(), Request(IV)),
-                                                        name='test'))
-        self.assertEqual(v.action(), 'done')
-        self.assertRaises(Exception, getattr, v, 'index')
-
-    def testInterfaceAndAttributeProtectedView(self):
-        xmlconfig(StringIO(template %
-            '''
-            <view name="test"
-                  factory="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  type="zope.app.component.tests.views.IV"
-                  permission="zope.Public"
-                  allowed_attributes="action"
-              allowed_interface="zope.app.component.tests.views.IV"
-                  />
-            '''
-            ))
-
-        v = zope.component.getMultiAdapter((Ob(), Request(IV)), name='test')
-        self.assertEqual(v.index(), 'V1 here')
-        self.assertEqual(v.action(), 'done')
-
-    def testDuplicatedInterfaceAndAttributeProtectedView(self):
-        xmlconfig(StringIO(template %
-            '''
-            <view name="test"
-                  factory="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  type="zope.app.component.tests.views.IV"
-                  permission="zope.Public"
-                  allowed_attributes="action index"
-              allowed_interface="zope.app.component.tests.views.IV"
-                  />
-            '''
-            ))
-
-        v = zope.component.getMultiAdapter((Ob(), Request(IV)), name='test')
-        self.assertEqual(v.index(), 'V1 here')
-        self.assertEqual(v.action(), 'done')
-
-    def testIncompleteProtectedViewNoPermission(self):
-        self.assertRaises(
-            ConfigurationError,
-            xmlconfig,
-            StringIO(template %
-            '''
-            <view name="test"
-                  factory="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  type="zope.app.component.tests.views.IV"
-                  allowed_attributes="action index"
-                  />
-            '''
-            ))
-
-    def testViewUndefinedPermission(self):
-        config = StringIO(template % (
-            '''
-            <view name="test"
-                  factory="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  type="zope.app.component.tests.views.IV"
-                  permission="zope.UndefinedPermission"
-                  allowed_attributes="action index"
-              allowed_interface="zope.app.component.tests.views.IV"
-                  />
-            '''
-            ))
-        self.assertRaises(ValueError, xmlconfig, config, testing=1)
-
-    def testResource(self):
-        ob = Ob()
-        self.assertEqual(
-            zope.component.queryAdapter(Request(IV), name=u'test'), None)
-        xmlconfig(StringIO(template % (
-            '''
-            <resource name="test"
-                  factory="zope.app.component.tests.views.R1"
-                  type="zope.app.component.tests.views.IV"/>
-            '''
-            )))
-
-        self.assertEqual(
-            zope.component.queryAdapter(Request(IV), name=u'test').__class__,
-            R1)
-
-    def testResourceThatProvidesAnInterface(self):
-        ob = Ob()
-        self.assertEqual(zope.component.queryAdapter(Request(IR), IV, u'test'),
-                         None)
-
-        xmlconfig(StringIO(template %
-            '''
-            <resource
-                name="test"
-                factory="zope.app.component.tests.views.R1"
-                type="zope.app.component.tests.views.IR"
-                />
-            '''
-            ))
-
-        v = zope.component.queryAdapter(Request(IR), IV, name=u'test')
-        self.assertEqual(v, None)
-
-        xmlconfig(StringIO(template %
-            '''
-            <resource
-                name="test"
-                factory="zope.app.component.tests.views.R1"
-                type="zope.app.component.tests.views.IR"
-                provides="zope.app.component.tests.views.IV"
-                />
-            '''
-            ))
-
-        v = zope.component.queryAdapter(Request(IR), IV, name=u'test')
-        self.assertEqual(v.__class__, R1)
-
-    def testUnnamedResourceThatProvidesAnInterface(self):
-        ob = Ob()
-        self.assertEqual(zope.component.queryAdapter(Request(IR), IV), None)
-
-        xmlconfig(StringIO(template %
-            '''
-            <resource
-                factory="zope.app.component.tests.views.R1"
-                type="zope.app.component.tests.views.IR"
-                />
-            '''
-            ))
-
-        v = zope.component.queryAdapter(Request(IR), IV)
-        self.assertEqual(v, None)
-
-        xmlconfig(StringIO(template %
-            '''
-            <resource
-                factory="zope.app.component.tests.views.R1"
-                type="zope.app.component.tests.views.IR"
-                provides="zope.app.component.tests.views.IV"
-                />
-            '''
-            ))
-
-        v = zope.component.queryAdapter(Request(IR), IV)
-        self.assertEqual(v.__class__, R1)
-
-    def testResourceUndefinedPermission(self):
-
-        config = StringIO(template % (
-            '''
-            <resource name="test"
-                  factory="zope.app.component.tests.views.R1"
-                  type="zope.app.component.tests.views.IV"
-                  permission="zope.UndefinedPermission"/>
-            '''
-            ))
-        self.assertRaises(ValueError, xmlconfig, config, testing=1)
-
-
 class ParticipationStub(object):
 
     def __init__(self, principal):
@@ -772,7 +386,6 @@
 
 def test_suite():
     return unittest.TestSuite((
-        unittest.makeSuite(Test),
         unittest.makeSuite(TestFactoryDirective),
         unittest.makeSuite(TestRequireDirective),
         DocTestSuite(),



More information about the Checkins mailing list