[Zope] DTML Document ids

Giuseppe Bonelli giuseppe.bonelli at tiscali.it
Thu Oct 16 07:54:17 EDT 2003


> -----Original Message-----
> From: Andreas Jung [mailto:andreas at andreas-jung.com]
> Sent: giovedi 16 ottobre 2003 13.12
> To: giuseppe.bonelli at tiscali.it; zope at zope.org
> Subject: Re: [Zope] DTML Document ids
>
>
>
>
> --On Donnerstag, 16. Oktober 2003 13:04 Uhr +0200 Giuseppe Bonelli
> <giuseppe.bonelli at tiscali.it> wrote:
>
> > Can someone explain to me why in the following code the
> line starting
> > with * outputs a null string and the line starting with **
> outputs the
> > correct id of the DTMLDocument object ?
> >
> > <dtml-var standard_html_header>
> > <dtml-in expr="objectItems('DTML Document')" prefix="sequence">
> > *<dtml-var "sequence_item.id"><br/>
>
> maybe because you haven't understand what the underscore
> namespace is about.
>

maybe, but..

> Use <dtml-var "_['sequence-item'].id" >

... if I use the above I get an error (id does not exists as attribute
of the DTML Document istance) ...

>
> And btw. *never* access the ID of an object why with 'id'.
> You should *ever*
> use obj.getId().

... and if I use:
<dtml-var "sequence_item.getId()"><br/>

I get the expected id.

Now, can you please elaborate a bit (or point me to some doc) on why I
should use the getId() method  instead of the id attribute? It happens
that I have exactly this bad habit and I have quite a lot of code where
I use id attributes :-(

Thank for the reply,

__peppo




More information about the Zope mailing list