Barry A. Warsaw wrote:
Thanks for the suggestion and explanation guys. Just to follow up, Michel's suggestion to use <dtml-with aq_explicit> to turn off acquisition did not work. Loren's suggestion to test on "hasProperty('nickname')" did the trick nicely. For completeness, here's the DTML for my current Breadcrumbs DTML method.
Oh did I say <dtml-with aq_explicit>? ;) My bad, this was my wrong suggestion: <dtml-with obj only> <dtml-with aq_explicit> <dtml-if nickname> ... The problem here is that the Nspace stack is masked and obj is pushed on to it. Then, aq_explicit is pushed on top of that, when a lookup for 'nickname' fails in aq_explicit, it drops down to the next object on the stack, which is obj, which *is* an implicit acquirer, so it does find nickname, which is why it doesn't work. What I really meant to say was: <dtml-if "_.hasattr(aq_explicit, 'nickname')"> <dtml-var nickname> <dtml-else> <dtml-var title_or_id> </dtml-if> In either case, Loren's suggestion is probably better and cleaner (but would not work for non property attributes named nickname, you may have a requirement for 'nickname' to be a SQLMethod, for example). -Michel