[Zope] object properties
Kapil Thangavelu
kthangavelu@earthlink.net
Sat, 14 Oct 2000 13:50:29 -0700
Matt wrote:
>
> Thanks for your response. I tried your methods on a normal folder that
> contains some other folders, dtmldocuments, and images, but it failed on the
> <dtml-let sheet=sequence-item> which followed the <dtml-in
> "propertysheets.items()">.
i made a simple error.
this code is tested and works properly (i had set PropList to a string
instead of a list)
<dtml-call "REQUEST.set('PropList', [])">
<dtml-in "propertysheets.items()">
<dtml-let sheet=sequence-item>
<dtml-in "sheet.propertyItems()">
<dtml-let prop=sequence-key>
<dtml-call "REQUEST['PropList'].append(prop)">
</dtml-let>
</dtml-in>
</dtml-let>
</dtml-in>
<dtml-var PropList>
This will show all the properties of an object (zclass, folders,
documents, etc).
> If I used <dtml-let sheet=sequence-key> instead, then I always got back only
> two strings, "default" and "webdav".
these are the names of the propertysheets of the folder.
> So I guess it is picking something else
> up. Any ideas? Perhaps I should be using ZClasses, but I just wanted to
> have what I thought would be the simple ability to loop through properties of
> an object without knowing what they were before.
you mentioned above that you tried this in a folder with a couple of
other folders and images in it, if what you're trying to do is iterate
over them than you're not looking for object properties but subobjects
(attrs) which can be iterated through using
<dtml-in "objectIds(['Folder'])">
<dtml-var sequence-item>
<dtml-in>
also check out objectItems, objectValues.
or using the ZDOM methods.
regardless the http://www.zope.org/Members/ZQR is always your friend.
Cheers
Kapil