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
From: "Joachim Werner" <joe@iuveno-net.de>
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.
Bingo! You pinpointed both the bug, and the reason why the first code worked even though the code was syntactically bogus. :-) Full score! I was confused for a whole minute until Johan pointed out the error. I was of course, as always, concentrating on the place where I did the change and the place where the error appeared. That is usually where the bug is. :-) Best Regards Lennart Regebro, Torped http://www.easypublisher.com/
participants (2)
-
Joachim Werner -
Lennart Regebro