[Zope3-dev] tagged value handling inconsequent for interface methods and attributes and interfaces themself

Grégoire Weber gregweblists at googlemail.com
Tue Nov 1 04:27:04 EST 2005


Just for the notes:

I first favoured something like this:

class IFoo(zope.interface.Interface):
    attr = zope.interface.Attribute('doc string')
    attr.someVariable = value

but this can't work if ``attr`` is defined in ``IBar`` and setting a
tagged value is done in ``IFoo`` (which is inheriting from ``IBar``)
like this:

class IBar(zope.interface.Interface):
    attr = zope.interface.Attribute('doc string')

class IFoo(IBar):
    attr.someVariable = value  # NameError


2005/10/24, Stephan Richter <stephan.richter at tufts.edu>:
> class IFoo(zope.interface.Interface):
>
>   attr = zope.interface.Attribute('doc string')
>   ITaggedValues(attr).someVariable = value
>
> Any comments before I spend time writing this up?

The drawback*) of this is that the adapter registry has to be in place.

*) Mostly a drawback if you only use ``zope.interface``

Gregoire


More information about the Zope3-dev mailing list