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:
> <dtml-with your_object>
> <dtml-let id_name=id> <!-- now: "id_name" contains a string -->
> <dtml-call "REQUEST.set('id_name',id_name)>
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:
<dtml-call "REQUEST.set('id_name', _['id'])">
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():
<dtml-call "REQUEST.set('id_name', getId())">
<dtml-call "REQUEST.set('id_name', your_object.getId())">
| Software Engineer mailto:[EMAIL PROTECTED]
| Digital Creations http://www.digicool.com/
| Creators of Zope http://www.zope.org/
Zope maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists -