[Zope] Zope and Polymorphism

Jay, Dylan djay@lucent.com
Wed, 9 Feb 2000 10:08:40 +1100


Thats really ugly having to know the distingishing method names.
Isn't there some method like
_.inheritsfrom(_['sequence-item'],'Folder')

???

> -----Original Message-----
> From: Steve Spicklemire [mailto:steve@spvi.com]
> Sent: Tuesday, February 08, 2000 11:07 PM
> To: ingo.assenmacher@post.rwth-aachen.de
> Cc: zope@zope.org
> Subject: Re: [Zope] Zope and Polymorphism
> 
> 
> 
> Hi Ingo,
> 
>    How about something like.... :
> 
> <dtml-in objectValues>
> <dtml-if "_.hasattr(_['sequence-item'],'isAnObjectManager')">
> 
> blah blah blah...
> 
> </dtml-if>
> </dtml-in>
> 
> -steve
> 
> --------------------------------------------------------------
> ------------
> Hi!
> 
> Since Zope is based on an OO-DB and you can add and edit objects in an
> intuitive manner, there is a question which does I simply can 
> not figure out:
> 
> You can inherit methods and attributes from other objects 
> (even multiplie
> inheritance), but do these objects behave like their parents 
> in respect to
> identification?
> 
> To illustrate my problem:
> 
> 
> UploadFolder inherits Folder
> 
> <dtml-in "objectValues(['Folder'])">
> [...]
> </dtml-in>
> 
> Imagine I have several Folders together with some 
> UploadFolders in one Folder
> container. The above code would simply enumerate over "real" 
> Folders, would it
> not?
> 
> There are two questions:
> 
> * maybe "objectValues" is the wrong method... which one does it?
> * do I have to know the class name *explicitly*? (this would 
> force me to
> rewrite enumerations of object every time I create new classes)
> 
> Thanks for the advices.
> 
> Regards, Ingo.
>