Re: [Zope] Equality test: if sequence-item = document id [excessive recursion error]
hello, re this earlier post which i'm still having problems with, can anyone enlighten me as to what could be causing this excessive recursion error (and how to avoid it)? cheers, G ------- Forwarded message follows ------- From: Garry Steedman <gs@styrax.com> To: tim@freepm.org Subject: Re: [Zope] Equality test: if sequence-item = document id Copies to: zope@zope.org, "Max Møller Rasmussen" <maxm@normik.dk> Send reply to: gs@styrax.com Date sent: Fri, 1 Jun 2001 14:52:32 +0000 Hi Tim, i don't understand why, but it doesn't work for me! what i have is this: a nav_stuff method: <DIV CLASS=navigation VALIGN="top"> <dtml-in "PARENTS[0].objectValues('DTML Document')" sort=menu_sort_order> <dtml-if "hasProperty('menu_sort_order')"> <dtml-if "_['sequence-item']==this_id"> <a href="&dtml-absolute_url;">[<dtml-var title>]</a> <dtml-else> </dtml-if> <a href="&dtml-absolute_url;"><dtml-var title></a> <dtml-else> </dtml-if> </dtml-in> </DIV> which is called from the standard header. the standard header and the nav_stuff method are in the same folder. if i have a document in a subfolder which calls the standard header, which in turn calls the code above, i get an excessive recursion error. any suggestions would be much appreciated! cheers, G On 1 Jun 2001, at 7:30, Tim Cook wrote: From: Tim Cook <twcook@iswt.com> Send reply to: tim@freepm.org Organization: Free Practice Management, Inc. To: gs@styrax.com Copies to: zope@zope.org, "Max Møller Rasmussen" <maxm@normik.dk> Subject: Re: [Zope] Equality test: if sequence-item = document id Date sent: Fri, 01 Jun 2001 07:30:22 -0500
Garry Steedman wrote:
max,
nope!
From: Garry Steedman [mailto:gs@styrax.com]
<dtml-in "PARENTS[0].objectIds('DTML Document')"> <dtml-if expr="_['sequence-item']=='this().id'"> <li><dtml-var sequence-item> <dtml-else> </dtml-if> </dtml-in>
which of course doesn't work, but i'm not sure why or what i need instead!
This works. It has something to do with resolving the string representation of the object id. I often use something that I've found that works. I don't necessarily care why. Maybe someday? <vbg>
<dtml-let this_id=id> <dtml-in "PARENTS[0].objectIds('DTML Document')"> <dtml-if expr="_['sequence-item']==this_id"> <li><dtml-var sequence-item></li> <dtml-else></dtml-if> </dtml-in> </dtml-let>
-- Tim Cook, President - FreePM,Inc. http://www.FreePM.com Office: (731) 884-4126 ONLINE DEMO: http://www.freepm.org:8080/FreePM
_______________________________________________ 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 )
------- End of forwarded message ------- +-------------------------------------------+ Garry Steedman mailto:gs@styrax.com Styrax Associates http://www.styrax.com/ "The Good Man has no shape." +-------------------------------------------+
Where are you setting this_id? Are you doing it like Tim illustrated? I don't see it in your code fragment. Tom P [Garry Steedman] re this earlier post which i'm still having problems with, can anyone enlighten me as to what could be causing this excessive recursion error (and how to avoid it)? cheers, G ------- Forwarded message follows ------- From: Garry Steedman <gs@styrax.com> To: tim@freepm.org Subject: Re: [Zope] Equality test: if sequence-item = document id Copies to: zope@zope.org, "Max Møller Rasmussen" <maxm@normik.dk> Send reply to: gs@styrax.com Date sent: Fri, 1 Jun 2001 14:52:32 +0000 Hi Tim, i don't understand why, but it doesn't work for me! what i have is this: a nav_stuff method: <DIV CLASS=navigation VALIGN="top"> <dtml-in "PARENTS[0].objectValues('DTML Document')" sort=menu_sort_order> <dtml-if "hasProperty('menu_sort_order')"> <dtml-if "_['sequence-item']==this_id"> <a href="&dtml-absolute_url;">[<dtml-var title>]</a> <dtml-else> </dtml-if> <a href="&dtml-absolute_url;"><dtml-var title></a> <dtml-else> </dtml-if> </dtml-in> </DIV> which is called from the standard header. the standard header and the nav_stuff method are in the same folder. if i have a document in a subfolder which calls the standard header, which in turn calls the code above, i get an excessive recursion error. any suggestions would be much appreciated! cheers, G On 1 Jun 2001, at 7:30, Tim Cook wrote: From: Tim Cook <twcook@iswt.com> Send reply to: tim@freepm.org Organization: Free Practice Management, Inc. To: gs@styrax.com Copies to: zope@zope.org, "Max Møller Rasmussen" <maxm@normik.dk> Subject: Re: [Zope] Equality test: if sequence-item = document id Date sent: Fri, 01 Jun 2001 07:30:22 -0500
Garry Steedman wrote:
max,
nope!
From: Garry Steedman [mailto:gs@styrax.com]
<dtml-in "PARENTS[0].objectIds('DTML Document')"> <dtml-if expr="_['sequence-item']=='this().id'"> <li><dtml-var sequence-item> <dtml-else> </dtml-if> </dtml-in>
which of course doesn't work, but i'm not sure why or what i need instead!
This works. It has something to do with resolving the string representation of the object id. I often use something that I've found that works. I don't necessarily care why. Maybe someday? <vbg>
<dtml-let this_id=id> <dtml-in "PARENTS[0].objectIds('DTML Document')"> <dtml-if expr="_['sequence-item']==this_id"> <li><dtml-var sequence-item></li> <dtml-else></dtml-if> </dtml-in> </dtml-let>
-- Tim Cook, President - FreePM,Inc. http://www.FreePM.com Office: (731) 884-4126 ONLINE DEMO: http://www.freepm.org:8080/FreePM
_______________________________________________ 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 )
------- End of forwarded message ------- +-------------------------------------------+ Garry Steedman mailto:gs@styrax.com Styrax Associates http://www.styrax.com/ "The Good Man has no shape." +-------------------------------------------+ _______________________________________________ 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 )
Tom, version control fsck-up: my apologies: here it is again (still doesn't work): <DIV CLASS=navigation VALIGN="top"> <dtml-let this_id=id> <dtml-in "PARENTS[0].objectValues('DTML Document')" sort=menu_sort_order> <dtml-if "hasProperty('menu_sort_order')"> <dtml-if expr="_['sequence-item']==this_id"> <a href="&dtml-absolute_url;">[<dtml-var title>]</a> <dtml-else> </dtml-if> <a href="&dtml-absolute_url;"><dtml-var title></a> <dtml-else> </dtml-if> </dtml-in> </dtml-let> </DIV> btw: am i completely stupid to think that the dtml-let will assign the id of the dtml method which contains it ( e.g. this_id = nav_stuff.id )? On 1 Jun 2001, at 11:42, Thomas B. Passin wrote: From: "Thomas B. Passin" <tpassin@mitretek.org> To: <zope@zope.org> Subject: Re: [Zope] Equality test: if sequence-item = document id [excessive recursion error] Date sent: Fri, 1 Jun 2001 11:42:12 -0400
Where are you setting this_id? Are you doing it like Tim illustrated? I don't see it in your code fragment.
Tom P
[Garry Steedman] re this earlier post which i'm still having problems with, can anyone enlighten me as to what could be causing this excessive recursion error (and how to avoid it)?
cheers,
G
------- Forwarded message follows ------- From: Garry Steedman <gs@styrax.com> To: tim@freepm.org Subject: Re: [Zope] Equality test: if sequence-item = document id Copies to: zope@zope.org, "Max Møller Rasmussen" <maxm@normik.dk> Send reply to: gs@styrax.com Date sent: Fri, 1 Jun 2001 14:52:32 +0000
Hi Tim,
i don't understand why, but it doesn't work for me!
what i have is this:
a nav_stuff method:
<DIV CLASS=navigation VALIGN="top"> <dtml-in "PARENTS[0].objectValues('DTML Document')" sort=menu_sort_order> <dtml-if "hasProperty('menu_sort_order')"> <dtml-if "_['sequence-item']==this_id"> <a href="&dtml-absolute_url;">[<dtml-var title>]</a> <dtml-else> </dtml-if> <a href="&dtml-absolute_url;"><dtml-var title></a> <dtml-else> </dtml-if> </dtml-in> </DIV>
which is called from the standard header.
the standard header and the nav_stuff method are in the same folder. if i have a document in a subfolder which calls the standard header, which in turn calls the code above, i get an excessive recursion error.
any suggestions would be much appreciated!
cheers,
G
On 1 Jun 2001, at 7:30, Tim Cook wrote:
From: Tim Cook <twcook@iswt.com> Send reply to: tim@freepm.org Organization: Free Practice Management, Inc. To: gs@styrax.com Copies to: zope@zope.org, "Max Møller Rasmussen" <maxm@normik.dk> Subject: Re: [Zope] Equality test: if sequence-item = document id Date sent: Fri, 01 Jun 2001 07:30:22 -0500
Garry Steedman wrote:
max,
nope!
From: Garry Steedman [mailto:gs@styrax.com]
<dtml-in "PARENTS[0].objectIds('DTML Document')"> <dtml-if expr="_['sequence-item']=='this().id'"> <li><dtml-var sequence-item> <dtml-else> </dtml-if> </dtml-in>
which of course doesn't work, but i'm not sure why or what i need instead!
This works. It has something to do with resolving the string representation of the object id. I often use something that I've found that works. I don't necessarily care why. Maybe someday? <vbg>
<dtml-let this_id=id> <dtml-in "PARENTS[0].objectIds('DTML Document')"> <dtml-if expr="_['sequence-item']==this_id"> <li><dtml-var sequence-item></li> <dtml-else></dtml-if> </dtml-in> </dtml-let>
-- Tim Cook, President - FreePM,Inc. http://www.FreePM.com Office: (731) 884-4126 ONLINE DEMO: http://www.freepm.org:8080/FreePM
_______________________________________________ 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 )
------- End of forwarded message ------- +-------------------------------------------+ Garry Steedman mailto:gs@styrax.com Styrax Associates http://www.styrax.com/
"The Good Man has no shape." +-------------------------------------------+
_______________________________________________ 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 )
_______________________________________________ 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 )
+-------------------------------------------+ Garry Steedman mailto:gs@styrax.com Styrax Associates http://www.styrax.com/ "The Good Man has no shape." +-------------------------------------------+
On Fri, 1 Jun 2001, Garry Steedman wrote: Try:
<DIV CLASS=navigation VALIGN="top"> <dtml-let this_id=id> <dtml-in "PARENTS[0].objectValues('DTML Document')" sort=menu_sort_order> <dtml-if "hasProperty('menu_sort_order')"> <dtml-if expr="_['sequence-item'].getId()==this_id"> ^^^^^^^^ ^^^^^^^^ -Michel
Garry Steedman wrote:
btw: am i completely stupid to think that the dtml-let will assign the id of the dtml method which contains it ( e.g. this_id = nav_stuff.id )?
I'm not sure I understood 'what' you were attempting to accomplish so my example may be way off base. I may have ass-u-me d what you meant? :-( I'll try to take a look at it later when I have some time, if you do not get a fix before then. -- Tim Cook, President - FreePM,Inc. http://www.FreePM.com Office: (731) 884-4126 ONLINE DEMO: http://www.freepm.org:8080/FreePM
Tim, thanks for the reply: i should have made myself clearer the first time round: at first i thought it was just an issue of stringifying things in order to compare them, but, once this is taken care of (as i suspect it is now) this fscking recursion error takes over. which, IINM means its a namespace problem. one of the things which puzzles me is that when i use objectIds() (as opposed to objectValues()), the recursion problem goes away, but i can't call the title variable without getting an authentication dialogue (which doesn't accept the admin pwd!) - now, i can get round this by using the title_or_id variable, but this renders as the title_or_id of the *current* document times the number of documents in the list (instead of the title_or_id of each document)! this, again, IINM, suggests a namespace problem. i guess i must be missing something fairly obvious because i can't believe i'm trying to do something particularly strange :( Folder_X [Folder] standard_x_header [DTML Method] nav_stuff_l1 [DTML Method] nav_stuff_l2 [DTML Method] Folder_Y [Folder] doc_1 [DTML Document] doc_2 [DTML Document] standard_x_header includes <dtml-var nav_stuff_l1> <dtml-var nav_stuff_l2> <nav_stuff_l1> is this: <dtml-comment> This method builds the 1st-level site navigation. It iterates through Folder objects below the site root, sorts them by the property "menu_sort_order" (which is an integer value starting at 0) and renders the Folder title (this is important because we can't put accents in the id) only if this property is present. The inside loop tests whether the current folder is in the list of folders and if it is it wraps square brackets around the title to highlight our current position. </dtml-comment> <DIV CLASS=navigation VALIGN="top"> <dtml-in "Folder_X.objectValues('Folder')" sort=menu_sort_order> <dtml-if "hasProperty('menu_sort_order')"> <dtml-if "this()==PARENTS[0]"> <a href="&dtml-absolute_url;">[<dtml-var title>]</a> <dtml-else> <a href="&dtml-absolute_url;"><dtml-var title></a> </dtml-if> <dtml-else> </dtml-if> </dtml-in> </DIV> <nav_stuff_l2> is this: <dtml-comment> This method builds the 2nd-level site navigation. It grabs the Folder of the current DTML Document [index_html] and iterates through the DTML Document objects inside it, rendering the document titles (because of accents, we don't want to render the document id) sorted by the menu_sort_order property. The inside loop tests the current document id against the list of document ids in the folder and wraps square brackets around the title to highlight the current document. </dtml-comment> <DIV CLASS=navigation VALIGN="top"> <dtml-let this_id=id> <dtml-in "PARENTS[0].objectValues('DTML Document')" sort=menu_sort_order> <dtml-if "hasProperty('menu_sort_order')"> <dtml-if expr="_['sequence-item'].getId()==this_id"> <a href="&dtml-absolute_url;">[<dtml-var title>]</a> <dtml-else> </dtml-if> <a href="&dtml-absolute_url;"><dtml-var title></a> <dtml-else> </dtml-if> </dtml-in> </dtml-let> </DIV> NB: <dtml-if expr="_['sequence-item'].getId()==this_id"> ^^^^^^^ added as per Michel Pelletier's suggestion. where the excessive recursion comes from i have no idea! :( cheers, Garry On 1 Jun 2001, at 13:53, Tim Cook wrote: From: Tim Cook <twcook@iswt.com> Send reply to: tim@freepm.org Organization: Free Practice Management, Inc. To: gs@styrax.com Copies to: zope@zope.org Subject: Re: [Zope] Equality test: if sequence-item = document id [excessive recursion error] Date sent: Fri, 01 Jun 2001 13:53:05 -0500
Garry Steedman wrote:
btw: am i completely stupid to think that the dtml-let will assign the id of the dtml method which contains it ( e.g. this_id = nav_stuff.id )?
I'm not sure I understood 'what' you were attempting to accomplish so my example may be way off base.
I may have ass-u-me d what you meant? :-(
I'll try to take a look at it later when I have some time, if you do not get a fix before then.
-- Tim Cook, President - FreePM,Inc. http://www.FreePM.com Office: (731) 884-4126 ONLINE DEMO: http://www.freepm.org:8080/FreePM
_______________________________________________ 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 )
+-------------------------------------------+ Garry Steedman mailto:gs@styrax.com Styrax Associates http://www.styrax.com/ "The Good Man has no shape." +-------------------------------------------+
--- Garry Steedman <gs@styrax.com> wrote: [snip]
<DIV CLASS=navigation VALIGN="top"> <dtml-let this_id=id> <dtml-in "PARENTS[0].objectValues('DTML Document')" sort=menu_sort_order> <dtml-if "hasProperty('menu_sort_order')"> <dtml-if expr="_['sequence-item'].getId()==this_id"> <a href="&dtml-absolute_url;">[<dtml-var title>]</a> <dtml-else> </dtml-if> <a href="&dtml-absolute_url;"><dtml-var title></a> <dtml-else> </dtml-if> </dtml-in> </dtml-let> </DIV>
NB: <dtml-if expr="_['sequence-item'].getId()==this_id"> ^^^^^^^ added as per Michel Pelletier's suggestion.
where the excessive recursion comes from i have no idea! :(
cheers,
Garry
One potential problem I notice: _['sequence-item'] will call the item if it is callable, which DTML documents are. This might explain the recursion if objectValues includes the very same Document that is executing (or one that calls this same method) My suggestion: Loose the _['sequence-item'] altogether. Because sequence-item is at the top of the namespace anyhow, the following should work: <dtml-if expr="getId()==this_id"> BTW: If you do need to access an object from the namespace *without* calling it like _[] does, use getitem as in: _.getitem('sequence-item') hth, ===== | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `-----------------> __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
participants (5)
-
Casey Duncan -
Garry Steedman -
Michel Pelletier -
Thomas B. Passin -
Tim Cook