[Zope] Re: CASE in point -- [Zope] Simple dtml-unless problem
Tim Hicks
Tim Hicks" <tim@sitefusion.co.uk
Thu, 14 Sep 2000 00:50:18 +0100
----- Original Message -----
From: "albert boulanger" <aboulang@ldeo.columbia.edu>
To: <phd@mail2.phd.pp.ru>
Cc: <tim@sitefusion.co.uk>; <zope@zope.org>
Sent: Wednesday, September 13, 2000 1:45 PM
Subject: CASE in point -- [Zope] Simple dtml-unless problem
>
> On Wed, 13 Sep 2000, Tim Hicks wrote:
> > <dtml-unless "id == 'index_html'">
>
> Sometimes id is string, sometimes it is a function.
>
> <dtml-unless "_['id'] == 'index_html'">
>
> This is a great example of DTML as a language having a multiple
> personality disorder. This violates a principle of consistent
> syntax/semantics. It wants to fool you that you could in fact do
> <dtml-unless "id == 'index_html'"> but no. I understand why DTML was
> designed this way, but in attempting to be a very convenient
language
> in syntactic simplicity, it did not do it to completion and there
are
> these traps that many of us learn over long weekends. Early adopters
> will go through this, but it is a "crossing the chasm" item to be
> addressed.
<snip>
----- Original Message -----
From: "Oleg Broytmann" <phd@phd.russ.ru>
To: "Tim Hicks" <tim@sitefusion.co.uk>
Cc: "Zope Mailing List" <zope@zope.org>
Sent: Wednesday, September 13, 2000 1:24 PM
Subject: Re: [Zope] Simple dtml-unless problem
> On Wed, 13 Sep 2000, Tim Hicks wrote:
> > > Sometimes id is string, sometimes it is a function.
> > >
> > > <dtml-unless "_['id'] == 'index_html'">
> >
> > Thanks very much guys. _['id'] fixed it.
>
> I hope you understand that I forced Zope to call the id()
function, but
> only if it is function. Else _['id'] just returns the id string.
>
<snip>
Thanks Albert and Oleg. If I'm honest, while I have become somewhat
familiar with what Albert describes as zope's 'multiple personality
disorder', I can't say I truly understand it. I still don't think I've
got my head around the _['whatever'] syntax. From what Oleg says, if
there is a method there, it will be called, otherwise it reverts to a
string! Wow, that sounds like an awkward way to go about things. If I
have that point right, how would I force zope to treat it as a string
using the _[ syntax?
Cheers guys
tim