[Zope] Equality test: if sequence-item = document id [excessive recursion error]

Casey Duncan casey_duncan@yahoo.com
Tue, 5 Jun 2001 08:59:36 -0700 (PDT)


--- 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">
> &nbsp;&nbsp;<a href="&dtml-absolute_url;">[<dtml-var
> title>]</a>
> <dtml-else>
> </dtml-if>
> &nbsp;&nbsp;<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/