[Checkins] SVN: zope.app.interface/branches/icemac-queryType/ - Moved ``zope.app.interfaces.queryType`` to `zope.app.content` to inverse dependency.
Michael Howitz
mh at gocept.com
Sat Sep 18 14:55:24 EDT 2010
Log message for revision 116605:
- Moved ``zope.app.interfaces.queryType`` to `zope.app.content` to inverse dependency.
Changed:
U zope.app.interface/branches/icemac-queryType/CHANGES.txt
U zope.app.interface/branches/icemac-queryType/buildout.cfg
U zope.app.interface/branches/icemac-queryType/setup.py
U zope.app.interface/branches/icemac-queryType/src/zope/app/interface/__init__.py
D zope.app.interface/branches/icemac-queryType/src/zope/app/interface/tests/test_queryinterface.py
-=-
Modified: zope.app.interface/branches/icemac-queryType/CHANGES.txt
===================================================================
--- zope.app.interface/branches/icemac-queryType/CHANGES.txt 2010-09-18 18:52:59 UTC (rev 116604)
+++ zope.app.interface/branches/icemac-queryType/CHANGES.txt 2010-09-18 18:55:24 UTC (rev 116605)
@@ -2,12 +2,16 @@
CHANGES
=======
-3.5.3 (unreleased)
+
+3.6.0 (unreleased)
------------------
- Added test extra to declare test dependency on `zope.testing`.
+- Moved ``zope.app.interfaces.queryType`` to `zope.app.content` to inverse
+ dependency.
+
3.5.2 (2010-07-08)
------------------
Modified: zope.app.interface/branches/icemac-queryType/buildout.cfg
===================================================================
--- zope.app.interface/branches/icemac-queryType/buildout.cfg 2010-09-18 18:52:59 UTC (rev 116604)
+++ zope.app.interface/branches/icemac-queryType/buildout.cfg 2010-09-18 18:55:24 UTC (rev 116605)
@@ -1,5 +1,6 @@
[buildout]
develop = .
+ ../zope.app.content
parts = test
[test]
Modified: zope.app.interface/branches/icemac-queryType/setup.py
===================================================================
--- zope.app.interface/branches/icemac-queryType/setup.py 2010-09-18 18:52:59 UTC (rev 116604)
+++ zope.app.interface/branches/icemac-queryType/setup.py 2010-09-18 18:55:24 UTC (rev 116605)
@@ -47,12 +47,14 @@
packages=find_packages('src'),
package_dir = {'': 'src'},
namespace_packages=['zope', 'zope.app'],
- install_requires=['setuptools',
- 'ZODB3',
- 'zodbcode',
- 'zope.componentvocabulary',
- 'zope.security',
- ],
+ install_requires=[
+ 'ZODB3',
+ 'setuptools',
+ 'zodbcode',
+ 'zope.app.content',
+ 'zope.componentvocabulary',
+ 'zope.security',
+ ],
extras_require=dict(test=[
'zope.testing',
]),
Modified: zope.app.interface/branches/icemac-queryType/src/zope/app/interface/__init__.py
===================================================================
--- zope.app.interface/branches/icemac-queryType/src/zope/app/interface/__init__.py 2010-09-18 18:52:59 UTC (rev 116604)
+++ zope.app.interface/branches/icemac-queryType/src/zope/app/interface/__init__.py 2010-09-18 18:55:24 UTC (rev 116605)
@@ -22,19 +22,20 @@
from persistent import Persistent
from zodbcode.patch import registerWrapper, Wrapper, NameFinder
-
from zope.interface.interface import InterfaceClass
from zope.interface import Interface
-from zope.security.proxy import removeSecurityProxy
-
from wref import FlexibleWeakKeyDictionary
+# BBB import
+from zope.app.content import queryType
+
+
class PersistentInterfaceClass(Persistent, InterfaceClass):
def __init__(self, *args, **kw):
Persistent.__init__(self)
InterfaceClass.__init__(self, *args, **kw)
-
+
self.dependents = FlexibleWeakKeyDictionary()
# PersistentInterface is equivalent to the zope.interface.Interface object
@@ -69,74 +70,4 @@
NameFinder.classTypes[PersistentInterfaceClass] = True
NameFinder.types[PersistentInterfaceClass] = True
-from zope.interface.declarations import providedBy
-def queryType(object, interface):
- """Returns the object's interface which implements interface.
-
- >>> from zope.interface import Interface
- >>> class IContentType(Interface):
- ... pass
- >>> from zope.interface import Interface, implements, directlyProvides
- >>> class I(Interface):
- ... pass
- >>> class J(Interface):
- ... pass
- >>> directlyProvides(I, IContentType)
- >>> class C(object):
- ... implements(I)
- >>> class D(object):
- ... implements(J,I)
- >>> obj = C()
- >>> c1_ctype = queryType(obj, IContentType)
- >>> c1_ctype.__name__
- 'I'
- >>> class I1(I):
- ... pass
- >>> class I2(I1):
- ... pass
- >>> class I3(Interface):
- ... pass
- >>> class C1(object):
- ... implements(I1)
- >>> obj1 = C1()
- >>> c1_ctype = queryType(obj1, IContentType)
- >>> c1_ctype.__name__
- 'I'
- >>> class C2(object):
- ... implements(I2)
- >>> obj2 = C2()
- >>> c2_ctype = queryType(obj2, IContentType)
- >>> c2_ctype.__name__
- 'I'
-
- >>> class C3(object):
- ... implements(I3)
- >>> obj3 = C3()
-
- If Interface doesn't provide `IContentType`, `queryType` returns ``None``.
-
- >>> c3_ctype = queryType(obj3, IContentType)
- >>> c3_ctype
- >>> c3_ctype is None
- True
- >>> class I4(I):
- ... pass
- >>> directlyProvides(I4, IContentType)
- >>> class C4(object):
- ... implements(I4)
- >>> obj4 = C4()
- >>> c4_ctype = queryType(obj4, IContentType)
- >>> c4_ctype.__name__
- 'I4'
-
- """
- # Remove the security proxy, so that we can introspect the type of the
- # object's interfaces.
- naked = removeSecurityProxy(object)
- object_iro = providedBy(naked).__iro__
- for iface in object_iro:
- if interface.providedBy(iface):
- return iface
-
- return None
Deleted: zope.app.interface/branches/icemac-queryType/src/zope/app/interface/tests/test_queryinterface.py
===================================================================
--- zope.app.interface/branches/icemac-queryType/src/zope/app/interface/tests/test_queryinterface.py 2010-09-18 18:52:59 UTC (rev 116604)
+++ zope.app.interface/branches/icemac-queryType/src/zope/app/interface/tests/test_queryinterface.py 2010-09-18 18:55:24 UTC (rev 116605)
@@ -1,30 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 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.
-#
-##############################################################################
-"""Doc test harness for queryType function.
-
-$Id$
-"""
-import unittest
-from zope.testing.doctestunit import DocTestSuite
-from zope.interface import Interface
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(DocTestSuite("zope.app.interface"))
-
- return suite
-
-
-if __name__ == '__main__':
- unittest.main()
More information about the checkins
mailing list