[Checkins] SVN: zope.app.interface/trunk/ Depend on zope.componentvocabulary, remove various test dependencies.

Martijn Faassen faassen at startifact.com
Tue May 19 16:31:34 EDT 2009


Log message for revision 100148:
  Depend on zope.componentvocabulary, remove various test dependencies.
  

Changed:
  U   zope.app.interface/trunk/CHANGES.txt
  U   zope.app.interface/trunk/buildout.cfg
  U   zope.app.interface/trunk/setup.py
  U   zope.app.interface/trunk/src/zope/app/interface/__init__.py
  U   zope.app.interface/trunk/src/zope/app/interface/configure.zcml
  D   zope.app.interface/trunk/src/zope/app/interface/tests/test_vocabulary.py
  U   zope.app.interface/trunk/src/zope/app/interface/vocabulary.py

-=-
Modified: zope.app.interface/trunk/CHANGES.txt
===================================================================
--- zope.app.interface/trunk/CHANGES.txt	2009-05-19 20:29:54 UTC (rev 100147)
+++ zope.app.interface/trunk/CHANGES.txt	2009-05-19 20:31:33 UTC (rev 100148)
@@ -2,6 +2,13 @@
 CHANGES
 =======
 
+3.5.0 (unreleased)
+------------------
+
+- Factor out ObjectInterfacesVocabulary into zope.componentvocabulary.
+
+- Remove various test dependencies.
+
 3.4.0 (2007-10-24)
 ------------------
 

Modified: zope.app.interface/trunk/buildout.cfg
===================================================================
--- zope.app.interface/trunk/buildout.cfg	2009-05-19 20:29:54 UTC (rev 100147)
+++ zope.app.interface/trunk/buildout.cfg	2009-05-19 20:31:33 UTC (rev 100148)
@@ -4,4 +4,4 @@
 
 [test]
 recipe = zc.recipe.testrunner
-eggs = zope.app.interface [test]
+eggs = zope.app.interface

Modified: zope.app.interface/trunk/setup.py
===================================================================
--- zope.app.interface/trunk/setup.py	2009-05-19 20:29:54 UTC (rev 100147)
+++ zope.app.interface/trunk/setup.py	2009-05-19 20:31:33 UTC (rev 100148)
@@ -47,11 +47,10 @@
       packages=find_packages('src'),
       package_dir = {'': 'src'},
       namespace_packages=['zope', 'zope.app'],
-      extras_require=dict(test=['zope.app.testing',
-                                'zope.app.content']),
       install_requires=['setuptools',
                         'ZODB3',
                         'zodbcode',
+                        'zope.componentvocabulary',
                         'zope.security',
                        ],
       include_package_data = True,

Modified: zope.app.interface/trunk/src/zope/app/interface/__init__.py
===================================================================
--- zope.app.interface/trunk/src/zope/app/interface/__init__.py	2009-05-19 20:29:54 UTC (rev 100147)
+++ zope.app.interface/trunk/src/zope/app/interface/__init__.py	2009-05-19 20:31:33 UTC (rev 100148)
@@ -74,7 +74,9 @@
 def queryType(object, interface):
     """Returns the object's interface which implements interface.
 
-    >>> from zope.app.content.interfaces import IContentType
+    >>> from zope.interface import Interface
+    >>> class IContentType(Interface):
+    ...    pass
     >>> from zope.interface import Interface, implements, directlyProvides
     >>> class I(Interface):
     ...     pass

Modified: zope.app.interface/trunk/src/zope/app/interface/configure.zcml
===================================================================
--- zope.app.interface/trunk/src/zope/app/interface/configure.zcml	2009-05-19 20:29:54 UTC (rev 100147)
+++ zope.app.interface/trunk/src/zope/app/interface/configure.zcml	2009-05-19 20:31:33 UTC (rev 100148)
@@ -1,8 +1,7 @@
 <configure xmlns="http://namespaces.zope.org/zope">
 
-  <utility
-      component=".vocabulary.ObjectInterfacesVocabulary"
-      name="Object Interfaces"
-      />
+  <!-- for backwards compatibility as the utility registration
+       was originally here -->
+  <include package="zope.componentvocabulary" />
 
 </configure>

Deleted: zope.app.interface/trunk/src/zope/app/interface/tests/test_vocabulary.py
===================================================================
--- zope.app.interface/trunk/src/zope/app/interface/tests/test_vocabulary.py	2009-05-19 20:29:54 UTC (rev 100147)
+++ zope.app.interface/trunk/src/zope/app/interface/tests/test_vocabulary.py	2009-05-19 20:31:33 UTC (rev 100148)
@@ -1,28 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 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.
-#
-##############################################################################
-"""Object Interface Vocabulary Tests
-
-$Id$
-"""
-import unittest
-from zope.testing.doctestunit import DocTestSuite
-from zope.app.testing import setup
-
-def test_suite():
-    return DocTestSuite('zope.app.interface.vocabulary',
-                        setUp=setup.placelessSetUp,
-                        tearDown=setup.placelessTearDown)
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')

Modified: zope.app.interface/trunk/src/zope/app/interface/vocabulary.py
===================================================================
--- zope.app.interface/trunk/src/zope/app/interface/vocabulary.py	2009-05-19 20:29:54 UTC (rev 100147)
+++ zope.app.interface/trunk/src/zope/app/interface/vocabulary.py	2009-05-19 20:31:33 UTC (rev 100148)
@@ -17,47 +17,5 @@
 """
 __docformat__ = 'restructuredtext'
 
-from zope.interface import classProvides, providedBy
-from zope.security.proxy import removeSecurityProxy
-from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm 
-from zope.schema.interfaces import IVocabularyFactory
-from zope.component.interface import interfaceToName
-
-
-class ObjectInterfacesVocabulary(SimpleVocabulary):
-    """A vocabulary that provides a list of all interfaces that its context
-    provides.
-
-    Here a quick demonstration:
-
-    >>> from zope.interface import Interface, implements
-    >>> class I1(Interface):
-    ...     pass
-    >>> class I2(Interface):
-    ...     pass
-    >>> class I3(I2):
-    ...     pass
-
-    >>> class Object(object):
-    ...     implements(I3, I1)
-
-    >>> vocab = ObjectInterfacesVocabulary(Object())
-    >>> import pprint
-    >>> names = [term.token for term in vocab]
-    >>> names.sort()
-    >>> pprint.pprint(names)
-    ['zope.app.interface.vocabulary.I1',
-     'zope.app.interface.vocabulary.I2',
-     'zope.app.interface.vocabulary.I3',
-     'zope.interface.Interface']
-    """
-    classProvides(IVocabularyFactory)
-
-    def __init__(self, context):
-        # Remove the security proxy so the values from the vocabulary
-        # are the actual interfaces and not proxies.
-        component = removeSecurityProxy(context)
-        interfaces = providedBy(component).flattened()
-        terms = [SimpleTerm(interface, interfaceToName(context, interface))
-                 for interface in interfaces]
-        super(ObjectInterfacesVocabulary, self).__init__(terms)
+# BBB
+from zope.componentvocabulary.vocabulary import ObjectInterfacesVocabulary



More information about the Checkins mailing list