Help! Why doesn't this work...
All I want to do is create a list of DTML Documents in a Folder that have a certain property defined. However, every variant I've tried of the following simple code causes an "Infinite recursion in document template" error: <dtml-in "PARENTS[0].objectValues(['DTML Document'])"> <dtml-var "_['sequence-item'].id"> </dtml-in> It seems to be caused by the reference to 'sequence-item', but for the life of me I can't figure out why this should cause a problem. Anyone have any ideas? Dave Morrill
On Thu, 14 Oct 1999, David C. Morrill wrote:
All I want to do is create a list of DTML Documents in a Folder that have a certain property defined.
However, every variant I've tried of the following simple code causes an "Infinite recursion in document template" error:
<dtml-in "PARENTS[0].objectValues(['DTML Document'])"> <dtml-var "_['sequence-item'].id"> </dtml-in>
It seems to be caused by the reference to 'sequence-item', but for the life of me I can't figure out why this should cause a problem. Anyone have any ideas?
objectValues returns a list of references to the objects. if your folder is called myfolder you could do somthing like: <dtml-in "myfolder.objectValues(['DTML Document'])"> <dtml-var title (or any other attribute of the object)> </dtml-in> Pavlos
All I want to do is create a list of DTML Documents in a Folder that have a certain property defined.
However, every variant I've tried of the following simple code causes an "Infinite recursion in document template" error:
<dtml-in "PARENTS[0].objectValues(['DTML Document'])"> <dtml-var "_['sequence-item'].id"> </dtml-in>
It seems to be caused by the reference to 'sequence-item', but for the life of me I can't figure out why this should cause a problem. Anyone have any ideas?
Eureka!!! After wasting nearly a full day on this, I've finally figured it out. The correct code is: <dtml-in "PARENTS[0].objectValues(['DTML Document'])"> <dtml-var "_.getitem('sequence-item').id"> </dtml-in> Apparently the first method evaluates 'sequence-item', which causes the recursion since the document containing the code is itself in the sequence. Ouch! Dave Morrill
Eureka!!! After wasting nearly a full day on this, I've finally figured it out. The correct code is:
<dtml-in "PARENTS[0].objectValues(['DTML Document'])"> <dtml-var "_.getitem('sequence-item').id"> </dtml-in>
How does that differ from ... <dtml-in "PARENTS[0].objectValues(['DTML Document'])"> <dtml-var id> </dtml-in> ... as another member suggested? -- Just curious -- Loren
How does that differ from ...
<dtml-in "PARENTS[0].objectValues(['DTML Document'])"> <dtml-var id> </dtml-in>
... as another member suggested?
It doesn't. However, I made the mistake of trying to simplify the actual problem I was having, which was to get the set of DTML documents having a certain property defined. I just simplified it to using 'id' because that showed the problem as well as the more complex form I was actually trying to use: <dtml-in "PARENTS[0].objectValues(['DTML Document'])"> <dtml-if "_.getitem('sequence-item').hasProperty('isMenu')"> ...do stuff using <dtml-var id>... </dtml-if> </dtml-in> My mistake. Next time I'll state the complete problem in all its gory details :) Dave Morrill
David C. Morrill wrote:
showed the problem as well as the more complex form I was actually trying to use:
<dtml-in "PARENTS[0].objectValues(['DTML Document'])"> <dtml-if "_.getitem('sequence-item').hasProperty('isMenu')"> ...do stuff using <dtml-var id>... </dtml-if> </dtml-in>
then try (untested): <dtml-in "PARENTS[0].objectValues(['DTML Document'])"> <dtml-if isMenu> ...do stuff using <dtml-var id>... </dtml-if> </dtml-in> or <dtml-in "PARENTS[0].objectIds(['DTML Document'])"> <dtml-if "_.getitem('sequence-item').hasProperty('isMenu')"> ...do stuff using <dtml-var id>... </dtml-if> </dtml-in> Pavlos
then try (untested): <dtml-in "PARENTS[0].objectValues(['DTML Document'])"> <dtml-if isMenu> ...do stuff using <dtml-var id>... </dtml-if> </dtml-in>
or
<dtml-in "PARENTS[0].objectIds(['DTML Document'])"> <dtml-if "_.getitem('sequence-item').hasProperty('isMenu')"> ...do stuff using <dtml-var id>... </dtml-if> </dtml-in>
I must be having a bad day. The code I included at the end of my last note was the code that actually works correctly. The one that doesn't work is: <dtml-in "PARENTS[0].objectValues(['DTML Document'])"> <dtml-if "_['sequence-item'].hasProperty('isMenu')"> ...do stuff using <dtml-var id>... </dtml-if> </dtml-in> In other words, I finally did manage to get the result I wanted, but the 'simplest' way (above) doesn't work, and it took me a long time to figure out why. Sorry for the confusion. Dave Morrill
Try this: <dtml-in "objectValues(['DTML Document'])"> <dtml-var id> </dtml-in> I think it should work. I don't know what is the problem with "_['sequence-item'].id". At 13:47 99-10-14 -0500, David C. Morrill wrote:
All I want to do is create a list of DTML Documents in a Folder that have a certain property defined.
However, every variant I've tried of the following simple code causes an "Infinite recursion in document template" error:
<dtml-in "PARENTS[0].objectValues(['DTML Document'])"> <dtml-var "_['sequence-item'].id"> </dtml-in>
It seems to be caused by the reference to 'sequence-item', but for the life of me I can't figure out why this should cause a problem. Anyone have any ideas?
Dave Morrill
****************************************************** Oscar Picasso picasso@videotron.ca ******************************************************
participants (4)
-
David C. Morrill -
Loren Stafford -
Oscar Picasso -
Pavlos Christoforou