Hi All I'm sure this is a dumb question, but I haven't been able to figure it out yet... If I have a bunch of objects of type 'myObj' in a folder, then I can do something like; <dtml-in "objectIds('myObj')> <dtml-var sequence-item><br> </dtml-in> ...to display a list of all the ids of my 'myObj' objects in the folder - so far, so good. Now, each of the 'myObj' instances has a property 'myProp', which I'm interested in. So I can do this; <dtml-in "objectValues('myObj')"> <dtml-var myProp><br> </dtml-in> ...to display a list of all the 'myProp' values of the 'myObj' objects. What I want to do is display a table where column one contains the id of the object, and column two contains the 'myProp' value. From a brief look at the source of "lib/python/OFS/ObjectManager.py" it looks as if the 'objectItems()' method might do something like what I want, but I haven't been able to get it to do what I want. Any ideas would be gratefully received! TIA David
On Wed, 9 Feb 2000, David Salgado wrote:
Hi All
[snip]
Now, each of the 'myObj' instances has a property 'myProp', which I'm interested in. So I can do this;
<dtml-in "objectValues('myObj')"> <dtml-var myProp><br> </dtml-in>
...to display a list of all the 'myProp' values of the 'myObj' objects.
What I want to do is display a table where column one contains the id of the object, and column two contains the 'myProp' value. From a brief look at the source of "lib/python/OFS/ObjectManager.py" it looks as if the 'objectItems()' method might do something like what I want, but I haven't been able to get it to do what I want.
How about this: <dtml-in "objectValues('myObj')"> <dtml-var sequence-var-id> -- <dtml-var sequence-var-myProp><br> </dtml-in> This is in the DTML reference, by the way.
Any ideas would be gratefully received!
Hope this helps.
David
--Jeff --- Jeff K. Hoffman 704.849.0731 x108 Chief Technology Officer mailto:jeff@goingv.com Going Virtual, L.L.C. http://www.goingv.com/
At 11:09 AM 2/9/00 -0500, Jeff K. Hoffman wrote:
On Wed, 9 Feb 2000, David Salgado wrote:
Hi All
[snip]
Now, each of the 'myObj' instances has a property 'myProp', which I'm interested in. So I can do this;
<dtml-in "objectValues('myObj')"> <dtml-var myProp><br> </dtml-in>
...to display a list of all the 'myProp' values of the 'myObj' objects.
What I want to do is display a table where column one contains the id of the object, and column two contains the 'myProp' value. From a brief look at the source of "lib/python/OFS/ObjectManager.py" it looks as if the 'objectItems()' method might do something like what I want, but I haven't been able to get it to do what I want.
How about this:
<dtml-in "objectValues('myObj')"> <dtml-var sequence-var-id> -- <dtml-var sequence-var-myProp><br> </dtml-in>
Is there any reason why you couldn't just do this? <dtml-in "objectValues('myObj')"> <dtml-var id> -- <dtml-var myProp><br> </dtml-in> James W. Howe mailto:jwh@allencreek.com Allen Creek Software, Inc. pgpkey: http://ic.net/~jwh/pgpkey.html Ann Arbor, MI 48103
On Wed, 9 Feb 2000, James W. Howe wrote:
Is there any reason why you couldn't just do this?
<dtml-in "objectValues('myObj')"> <dtml-var id> -- <dtml-var myProp><br> </dtml-in>
Nope, not at all. I guess I've just gotten into the habit of using the more explicit form. Can't remember why, at the moment. Perhaps there is no good reason at all. ;-) --Jeff --- Jeff K. Hoffman 704.849.0731 x108 Chief Technology Officer mailto:jeff@goingv.com Going Virtual, L.L.C. http://www.goingv.com/
Hi, I need to "lock" aquisition to all me to display a tree of folders. I have a tree navigation control called by standard_html_header that I would like to always show a subtree of my site. I think that I have to limit the namespace but can't seem to get the syntax right. How do I lock the root of the tree tag to one specific place in the heirarchy? My latest code attempt is below: <dtml-with "PARENTS[-1].SiteRoot.Pub"> <dtml-tree Pub branches_expr="objectValues('Folder')" sort=id> <a href="<dtml-var tree-item-url>/index_html"> <dtml-var title_or_id></a> </dtml-tree> </dtml-with> Thanks for your help. Chip Vanek chip@upcast.com
Searched many, many postings and found some hints but no solutions yet. The trick below works if you call the method from a branch below. <dtml-tree expr="PARENTS[-2]" branches_expr="objectValues('Folder')" sort=id> <a href="<dtml-var tree-item-url>/index_html"> <dtml-var title_or_id></a> </dtml-tree> The problem is I want to use this tree as a navigator for one branch of the site while users may be down in another branch of the site at the same depth (like the Members area). The code above will paint a tree with tortured URLs if the user1 is viewing their index_html page. http://host.com/SiteRoot/ Pub/ Folder1 Folder2 Branch1 Branch2 Folder3 ..... /Members/ user1 index_html user2 .....
I need to "lock" aquisition to all me to display a tree of folders. I have a tree navigation control called by standard_html_header that I would like to always show a subtree of my site. I think that I have to limit the namespace but can't seem to get the syntax right. How do I lock the root of the tree tag to one specific place in the heirarchy? My latest code attempt is below:
<dtml-with "PARENTS[-1].SiteRoot.Pub"> <dtml-tree Pub branches_expr="objectValues('Folder')" sort=id> <a href="<dtml-var tree-item-url>/index_html"> <dtml-var title_or_id></a> </dtml-tree> </dtml-with>
Thanks for your help.
Chip Vanek chip@upcast.com
Hi, Does anyone know how to "lock" the namespace (dtml-with or dtml-let) inside dtml to ensure that the dtml-tree tag always displays the same tree? Or alternatly what is the ideal syntax to create an dtml-if that can check if the present method is below the tree tag. I am using the code below but, it only works if I am in the Pub folder not in any of the children folders of Pub. <dtml-if "_.getattr(PARENTS[0], 'id') == 'Pub'"> <dtml-tree .......> </dtml-if> Any help would be GREATLY appreciated. Best, Chip
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Chip Vanek Sent: Monday, February 14, 2000 9:30 PM To: zope@zope.org Subject: RE: [Zope] How to create "Locked" folder tree?
Searched many, many postings and found some hints but no solutions yet.
The trick below works if you call the method from a branch below. <dtml-tree expr="PARENTS[-2]" branches_expr="objectValues('Folder')" sort=id> <a href="<dtml-var tree-item-url>/index_html"> <dtml-var title_or_id></a> </dtml-tree>
The problem is I want to use this tree as a navigator for one branch of the site while users may be down in another branch of the site at the same depth (like the Members area). The code above will paint a tree with tortured URLs if the user1 is viewing their index_html page.
http://host.com/SiteRoot/ Pub/ Folder1 Folder2 Branch1 Branch2 Folder3 .....
/Members/ user1 index_html user2 .....
I need to "lock" aquisition to all me to display a tree of folders. I have a tree navigation control called by standard_html_header that I would like to always show a subtree of my site. I think that I have to limit the namespace but can't seem to get the syntax right. How do I lock the root of the tree tag to one specific place in the heirarchy? My latest code attempt is below:
<dtml-with "PARENTS[-1].SiteRoot.Pub"> <dtml-tree Pub branches_expr="objectValues('Folder')" sort=id> <a href="<dtml-var tree-item-url>/index_html"> <dtml-var title_or_id></a> </dtml-tree> </dtml-with>
Thanks for your help.
Chip Vanek chip@upcast.com
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Chip Vanek Sent: dinsdag 15 februari 2000 22:26 To: zope@zope.org Subject: RE: [Zope] How to create "Locked" folder tree?
Hi,
Does anyone know how to "lock" the namespace (dtml-with or dtml-let) inside dtml to ensure that the dtml-tree tag always displays the same tree?
Or alternatly what is the ideal syntax to create an dtml-if that can check if the present method is below the tree tag. I am using the code below but, it only works if I am in the Pub folder not in any of the children folders of Pub.
<dtml-if "_.getattr(PARENTS[0], 'id') == 'Pub'"> <dtml-tree .......> </dtml-if>
My solution reads: <dtml-call "REQUEST.set('authorized', 0)"> <dtml-in PARENTS> <dtml-if "id=='Pub'"> <dtml-call "REQUEST.set('authorized', 1)"> </dtml-if> </dtml-in> <dtml-if authorized> <dtml-tree ...> </dtml-if> cb
Thanks Cornelis, I ended up with something similar to your tip and of course stumbled across more problem. Here is the code that I will endup using as an interim to keep some momentum going on this project. Thanks for your help again, Chip If anyone is interested this is the resulting (very ugly and inefficient) code. This climbs up the folder tree and creates two lists. One in forward order the other in reverse. The reverse list is displayed as a navigator and the forward list is converted to string and used to query the catalog for items. If anyone has improvements ;) <dtml-call "REQUEST.set('tkeysreverse', [])"> <dtml-call "REQUEST.set('tkeysforward', [])"> <dtml-call "REQUEST.set('Topic', '')"> <dtml-in PARENTS skip_unauthorized reverse> <dtml-unless sequence-start> <dtml-unless "id == 'PortalRoot' or id == 'Pub'"> <span class="ItemBack"> <dtml-with sequence-item> <dtml-call "tkeysreverse.insert(0, id)"> <dtml-call "tkeysforward.append(id)"> <a href="<dtml-var absolute_url>/showTopics"> <dtml-var id></a> </dtml-with> <dtml-unless sequence-end> > </dtml-unless> </span> </dtml-unless> </dtml-unless> </dtml-in>
-----Original Message----- From: Cornelis J. de Brabander [mailto:brabander@fsw.LeidenUniv.nl] Sent: Wednesday, February 16, 2000 12:41 AM To: Chip Vanek; zope@zope.org Subject: RE: [Zope] How to create "Locked" folder tree?
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Chip Vanek Sent: dinsdag 15 februari 2000 22:26 To: zope@zope.org Subject: RE: [Zope] How to create "Locked" folder tree?
Hi,
Does anyone know how to "lock" the namespace (dtml-with or dtml-let) inside dtml to ensure that the dtml-tree tag always displays the same tree?
Or alternatly what is the ideal syntax to create an dtml-if that can check if the present method is below the tree tag. I am using the code below but, it only works if I am in the Pub folder not in any of the children folders of Pub.
<dtml-if "_.getattr(PARENTS[0], 'id') == 'Pub'"> <dtml-tree .......> </dtml-if>
My solution reads: <dtml-call "REQUEST.set('authorized', 0)"> <dtml-in PARENTS> <dtml-if "id=='Pub'"> <dtml-call "REQUEST.set('authorized', 1)"> </dtml-if> </dtml-in> <dtml-if authorized> <dtml-tree ...> </dtml-if>
cb
How about (untested) <table> <tr><th>ID</th><th>Property</th></tr> <dtml-in "objectItems(['myObj'])"> <tr><td><dtml-var sequence-item></td><td><dtml-var myProp></td></tr> </dtml-in> </table> You might have to change sequence-item to sequence-key, maybe?!? Also, this would probably only be usable from within a DTML Method?!? HTH Phil phil.harris@zope.co.uk | -----Original Message----- | From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of David | Salgado | Sent: Wednesday, February 09, 2000 3:03 PM | To: 'zope@zope.org' | Subject: [Zope] Object ID and Property confusion | | | Hi All | | I'm sure this is a dumb question, but I haven't been able to | figure it out | yet... | | If I have a bunch of objects of type 'myObj' in a folder, then I can do | something like; | | <dtml-in "objectIds('myObj')> | <dtml-var sequence-item><br> | </dtml-in> | | ...to display a list of all the ids of my 'myObj' objects in the | folder - so | far, so good. | | Now, each of the 'myObj' instances has a property 'myProp', which I'm | interested in. So I can do this; | | <dtml-in "objectValues('myObj')"> | <dtml-var myProp><br> | </dtml-in> | | ...to display a list of all the 'myProp' values of the 'myObj' objects. | | What I want to do is display a table where column one contains | the id of the | object, and column two contains the 'myProp' value. From a brief | look at the | source of "lib/python/OFS/ObjectManager.py" it looks as if the | 'objectItems()' method might do something like what I want, but I haven't | been able to get it to do what I want. | | Any ideas would be gratefully received! | | TIA | David | | | _______________________________________________ | Zope maillist - Zope@zope.org | http://lists.zope.org/mailman/listinfo/zope | ** No cross posts or HTML encoding! ** | (Related lists - | http://lists.zope.org/mailman/listinfo/zope-announce | http://lists.zope.org/mailman/listinfo/zope-dev ) |
participants (6)
-
Chip Vanek -
Cornelis J. de Brabander -
David Salgado -
James W. Howe -
Jeff K. Hoffman -
Phil Harris