[Zope-dev] This was fun!!!

Joachim Werner joe@iuveno-net.de
Tue, 15 Oct 2002 18:32:37 +0200


I won't look into the DTML Parser code right now. Don't need no headache ;-)

But this is my first guess:

> > <dtml-if getEasyLanguageService>

DTML looks at "getEasyLanguageService" and does an implicit
"getEasyLanguageService()". So now "getEasyLanguageService" (as an attribute
in the DTML namespace) represents the actual service object the method
should return.

> >           <dtml-let ELS="getEasyLanguageService">

ELS represents the service object now

> >               <dtml-in getAllLanguages>
> >                 <dtml-var "ELS.getLanguageByRFC3066(_['sequence-item'])"

the getLanguageByRFC3066() method of the service object is called


And here it fails because:


> > <dtml-if "is_language_aware() and getEasyLanguageService()">

getEasyLanguageService() is called explicitly, and in the "", so DTML does
no magic. It does NOT put the returned service object into the namespace as
"getEasyLanguageService" (as it would do in the first example)

> >           <dtml-let ELS="getEasyLanguageService">

the method "getEasyLanguageService", not its return value (i.e. the language
service object) is passed to ELS

> >               <dtml-in getAllLanguages>
> >                 <dtml-var "ELS.getLanguageByRFC3066(_['sequence-item'])"

This fails because Zope tries to get the getLanguageByRFC3066() method of
the method (or function) getEasyLanguageService (without ()), and that is
not allowed here.

Yep

Joachim