Re: [Zope] Help save my sanity (DTML-in string comparison)

2000-12-19 Thread Martijn Pieters

On Tue, Dec 19, 2000 at 09:57:31PM +0100, Dieter Maurer wrote:
> Darin Lee writes:
>  > ... comparisons involving "id" do not work ...
> "id" is particularly difficult in DTML.
> 
> For some objects, "id" is an attribute (a string),
> for others, it is a method.
> 
> Due to Zope's acquisition magic, it is difficult
> to compare method's to one another:
> the "same" method compare different, if accessed on different
> access paths.
> 
> Thus, you want to work with strings only.
> The problem is: DTML does not let you test for types.
> 
> You can do something like this:
> 
> 
>
> 
>   
> 

Or you could use "_['id']" in place of "id". Which does exactly the same
as the let tag does in the above statement, ie a lookup in the namespace
and then calling it if it is a method. Example:

  

  

This kind of hoopjumping is exactly why in Zope 2.3 you now can use the
method 'getId()', which will hide the confusion for you. From Zope 2.3
onwards, *always* use getId():

  

  

or:

  

-- 
Martijn Pieters
| Software Engineer  mailto:[EMAIL PROTECTED]
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/
-

___
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] Help save my sanity (DTML-in string comparison)

2000-12-19 Thread Dieter Maurer

Darin Lee writes:
 > ... comparisons involving "id" do not work ...
"id" is particularly difficult in DTML.

For some objects, "id" is an attribute (a string),
for others, it is a method.

Due to Zope's acquisition magic, it is difficult
to compare method's to one another:
the "same" method compare different, if accessed on different
access paths.

Thus, you want to work with strings only.
The problem is: DTML does not let you test for types.

You can do something like this:


   

  



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] Help save my sanity (DTML-in string comparison)

2000-12-18 Thread Michael Bernstein

Darin Lee wrote:
> 
> Zopistas,
> 
> I am trying to build a simple, 2 tier, tree-style navigation structure for my site. 
>I have puzzled over the following code for hours, and it's just not working right. I 
>have two loops, one that goes through the Parents, and when the parent matches the 
>current folder, I go through the children (There are 2 scripts, one that resides one 
>level up and presents a simple list of objects to click on) The following code lives 
>in the child folders, and displays the parents and all of the HTML documents in the 
>current folder.
> 
> The output I am looking for resembles below.
> 
> [snip]
> 
> ¯--
> BTW, I have tried the NFGNav product, but It doesn't work in my application (I 
>suspect) because I am using transparent folders to organize things. I also want my 
>NAV to start farther down the heirarchy (level 2), not from the root.

Try ZNavigator, instead.

HTH,

Michael Berrnstein.

___
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 )