[z3-five] Fwd: Re: class/content test

Balazs Ree ree at ree.hu
Fri Jul 14 11:01:45 CEST 2006


On Thu, 13 Jul 2006 22:54:11 +0200, Philipp von Weitershausen wrote:

> Balasz Ree sent me this patch with a failing test a while ago. I know what
> the fix is (removing a false descriminator of the ContentDirective
> handler), this is just to remind myself (and perhaps others) of this issue
> (so it won't get lost in the depths of my inbox).

Well, I did not see the attachment on your post, so just in case I post
the patch (for not to be the only one who knows what the issue is).

Briefly: currently when you add more interfaces to the same class with
some consequtive <class> (formerly <content>) directives, it results in a
conflict. (Same thing does work with <five:implements>.)

p.s. I did not get to understand how to fix it.


Index: tests/classes.py
===================================================================
--- tests/classes.py	(revision 0)
+++ tests/classes.py	(revision 0)
@@ -0,0 +1,32 @@
+##############################################################################
+#
+# Copyright (c) 2004, 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.
+#
+##############################################################################
+"""interfaces test fixtures
+
+$Id:  $
+"""
+from zope.interface import implements, Interface
+
+class One(object):
+    'A class'
+
+class Two(object):
+    'Another class'
+
+class IOne(Interface):
+    """This is a Zope 3 interface.
+    """
+
+class ITwo(Interface):
+    """This is another Zope 3 interface.
+    """
Index: tests/test_directives.py
===================================================================
--- tests/test_directives.py	(revision 68659)
+++ tests/test_directives.py	(working copy)
@@ -59,6 +59,14 @@
       >>> dest.method()
       'Overridden'
 
+    Check the result of the <class> directives
+
+      >>> from Products.Five.tests.classes import One, Two, IOne, ITwo
+      >>> IOne.implementedBy(One)
+      True
+      >>> ITwo.implementedBy(One)
+      True
+
     Clean up adapter registry and others:
 
       >>> from zope.testing.cleanup import cleanUp
Index: tests/directives.zcml
===================================================================
--- tests/directives.zcml	(revision 68659)
+++ tests/directives.zcml	(working copy)
@@ -24,4 +24,15 @@
       factory=".adapters.OriginalAdapter"
       />
 
+  <!-- this tests whether content / class can be declared on the same class
+       with two different interfaces. -->
+
+  <class class=".classes.One" >
+    <implements interface=".classes.IOne" />
+  </class>
+
+  <class class=".classes.One" >
+    <implements interface=".classes.ITwo" />
+  </class>
+
 </configure>



-- 
Balazs Ree




More information about the z3-five mailing list