hi there!

I'm trying to implement a vocabulary that provides an interface based on this:

from zope.interface import implements
from Products.Archetypes.interfaces import IVocabulary
from Products.Archetypes.utils import DisplayList

sampleDisplayList = DisplayList([('e1', 'e1'), ('element2', 'element2')])


class sampleInterfaceVocabulary:
    implements(IVocabulary)

    def getDisplayList(self, instance):
        return sampleDisplayList


I wrote a test to verify that the vocabulary is in fact providing the interface:

class Test(TestCase):

    def test_vocabulary_class(self):
        sample = sampleInterfaceVocabulary()
        self.failUnless(IVocabulary.providedBy(sample),
            'IVocabulary not provided by object')

the test fails; if I use Interface instead of IVocabulary the test passes:

        self.failUnless(Interface.providedBy(sample),
            'Interface not provided by object')


IVocabulary inherits from Interface, as you can see:

from zope.interface import Interface, Attribute

class IVocabulary(Interface):
    """ interface for vocabularies used in fields """

    def getDisplayList(self, instance):
        """ returns an object of class DisplayList as defined in
            Products.Archetypes.utils.

            The instance of the content is given as parameter.
        """


what I'm doing wrong?

best regards
--
Héctor Velarde


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Product-Developers mailing list
[email protected]
https://lists.plone.org/mailman/listinfo/product-developers

Reply via email to