[Zope3-Users] Interface confusion (still)
Shailesh Kumar
shaileshk at gmail.com
Tue Jul 15 15:03:32 EDT 2008
Hi,
I believe not. In any case, implements, provides and such things are more
like indications of what is being supported by a class and they are not
enforced by runtime strictly.
I just tried following:
#####################################################################
from zope.component import *
from zope.interface import *
from zope.interface.verify import *
class IA(Interface): pass
class IB(IA): pass
class B(object):
implements(IB)
verifyClass(IA, B) #returns True
verifyClass(IB, B) #returns True
verifyClass(Interface, B) #returns True
class IC(Interface) : pass
#####################################################################
Its usually a good idea to setup unit tests for testing these kind of
things.
With regards,
- Shailesh
On 7/15/08, Tim Cook <timothywayne.cook at gmail.com> wrote:
>
> If interface B inherits from interface A and class B implements
> interface B; do I need to explicitly state that class B provides
> interface A?
>
> Concrete example:
>
> class IElement(Interface):
> value = Object(
> schema=IDataValue,
> title=_(u"value"),
> description=_(u"""Data value of this leaf."""),
> required=False
> )
>
> class IDvText(IDataValue):
>
> ...
>
>
> class DvText(DataValue):
>
> ....
>
> implements(IDvText)
> classProvides(IDvText)
>
>
> Will Element.value allow instances of DvText or do I need to change the
> DvText classProvides call to:
>
> classProvides(IDataValue,IDvText)
>
> Thanks,
> Tim
>
>
>
>
>
> --
> Timothy Cook, MSc
> Health Informatics Research & Development Services
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
> Skype ID == timothy.cook
> **************************************************************
> *You may get my Public GPG key from popular keyservers or *
> *from this link http://timothywayne.cook.googlepages.com/home*
> **************************************************************
>
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-users/attachments/20080715/bd7b0254/attachment-0001.html
More information about the Zope3-users
mailing list