[Zope] Problems with Coding differences to do same stuff...boundary="------------EAFFAD5A57052936695E91D7"
Dieter Maurer
dieter@handshake.de
Thu, 20 Jul 2000 20:31:18 +0200 (CEST)
Felipe E Barousse Boue writes:
> I know about not beeing allowed to access attributes that start with "_".
I gave you a solution in my post, didn't I?
Again, try:
<dtml-with "_.getattr(company.noticias,_[titulo])">
<dtml-call ....>
</dtml-with>
> Actually what is intended here is for _[titulo] to be evaluated to the name
> of a folder ...
Of cause.
However, your expressions do not work like this.
They have an evaluation order: "a.b[c]" is "(a.b)[c]" and not
"a. (b[c])".
To give you a better known analogy:
if you have "5 * 1+1" then the result is "6" and
not "10", even so "1+1" is "2" in a different context.
In the special case of the "." operator, the right parameter must
even be a name and can not be an expression.
Thus, "a . (b[c])" is a syntax error.
You have the "getattr" operator to obtain such "computed accesses":
to obtain the effect of "a .(b[c])", you use "getattr(a,b[c])".
That is what I proposed above (and in the last post).
Dieter