[Zope3-Users] Interface confusion (still)

Tim Cook timothywayne.cook at gmail.com
Tue Jul 15 18:31:29 EDT 2008


The purpose of this question is related to an earlier question I had
about using the best/correct schema field choice.  It was pointed out
that I should use 'Object' and set the schema to the interface of the
class(es) that I wanted that attribute to accept.  Since I did not point
out that all of the classes that I wanted an attribute to accept would
be descendants of that base class (and their interfaces) that is
probably where I misunderstood that I would need to use classProvides. 

On Tue, 2008-07-15 at 21:39 +0200, Markus Kemmerling wrote:
> An instance of a class provides not only the interface the class  
> declares to implement, but also all base interfaces of this  
> interface. In particular an instance that povides any interface, will  
> always provide 'Interface'.

... and that makes perfect sense.


> Note: classes *implement* interfaces, their instances *provide* them.

... and I am still confused about a use case for classProvides.

> You probably don't want to use 'classProvides' at all.  The  
> 'implements(IDvText)'  statement is enough for all instances of  
> 'DvText' to provide 'IDataValue'.

Barring any replies to the contrary; I will remove all the superfluous
classProvides calls. Since this makes sense to me and was my original
understanding.  Basically that interface inheritance acts just like
class inheritance. 

Thanks,
Tim



-- 
**************************************************************************
Join the OSHIP project.  It is the standards based, open source
healthcare application platform in Python.
Home page: https://launchpad.net/oship/ 
Wiki: http://www.openehr.org/wiki/display/dev/Python+developer%27s+page 
**************************************************************************
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20080715/0d5601c6/attachment.bin


More information about the Zope3-users mailing list