Re: [Zope] Re: CASE in point -- [Zope] Simple dtml-unless problem
> 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. You like that you can use both for properties, external methods and DTML objects? If you do, then you probably like that "_['name']" does the same. "_[...]" evaluates '...' (which should yield a string), looks that up in the namespace (giving an object), determines what type it is (external method, DTML object, something callable, something else) and does what usually is right for such an object. This means, it either calls the method/object with appropriate parameters or returns the object itself (if not callable). If you do not like this, you can use "_.getitem(...)". This returns the object itself, without magical type specific handling. I think, the "multiple personality disorder" does not refer to this "_[...]" intelligence but to the fact, that "id" usually is a (parameterless) method but sometimes is an attribute. The "_[...]" and "" magic usually hides this disorder, but without the magic, you may get hit by this design flaw. Dieter ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] Re: CASE in point -- [Zope] Simple dtml-unless problem
On Thu, 14 Sep 2000, Tim Hicks wrote: > 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? I think you cannot. Probbaly the best you can try is _.getitem("thing", 0) ^ do not render the object Oleg. Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ___ Zope maillist - [EMAIL PROTECTED] 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] Re: CASE in point -- [Zope] Simple dtml-unless problem
- Original Message - From: "albert boulanger" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> 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: >> > > Sometimes id is string, sometimes it is a function. > > > > 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 > 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. - Original Message - From: "Oleg Broytmann" <[EMAIL PROTECTED]> To: "Tim Hicks" <[EMAIL PROTECTED]> Cc: "Zope Mailing List" <[EMAIL PROTECTED]> 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. > > > > > > > > > > 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. > 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 ___ Zope maillist - [EMAIL PROTECTED] 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] CASE in point -- [Zope] Simple dtml-unless problem
On Wed, 13 Sep 2000, Tim Hicks wrote: > Sometimes id is string, sometimes it is a function. 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 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. Regards, Albert Boulanger [EMAIL PROTECTED] ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] Simple dtml-unless problem
On Wed, 13 Sep 2000, Tim Hicks wrote: > >Sometimes id is string, sometimes it is a function. > > > > > > 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. Oleg. Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ___ Zope maillist - [EMAIL PROTECTED] 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] Simple dtml-unless problem
I have the following code in my standard_html_header The problem is, it displays the and stuff even when the page that the standard_html_header is being dropped into is index_html. I'm pretty sure I'm missing something really silly here, but if anyone could point it out, I'd really appreciate it. cheers tim ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] Simple dtml-unless problem
- Original Message - From: "Oleg Broytmann" <[EMAIL PROTECTED]> To: "Tim Hicks" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, September 13, 2000 12:56 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. > > > Thanks very much guys. _['id'] fixed it. tim > Oleg. > > Oleg Broytmannhttp://phd.pp.ru/ [EMAIL PROTECTED] >Programmers don't die, they just GOSUB without RETURN. > ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] Simple dtml-unless problem
On Wed, 13 Sep 2000, Tim Hicks wrote: > Sometimes id is string, sometimes it is a function. Oleg. Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] Simple dtml-unless problem
Depending on the object in question id could be a method, so you might want to try: hth Phil - Original Message - From: "Tim Hicks" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, September 13, 2000 12:23 PM Subject: [Zope] Simple dtml-unless problem > I have the following code in my standard_html_header > > > alt=""> > > > > The problem is, it displays the and stuff even when the > page that the standard_html_header is being dropped into is > index_html. I'm pretty sure I'm missing something really silly here, > but if anyone could point it out, I'd really appreciate it. > > cheers > > tim > > > ___ > Zope maillist - [EMAIL PROTECTED] > 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 - [EMAIL PROTECTED] 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 )