<dtml-var> namespace resolution monitoring?
Hello everyone, I am currently working with a large DTML script that someone else wrote and I am stuck. I am trying to determine how a certain <dtml-var foo> is being resolved from the namespace. More precisely, I know that it is not acquiring its value from the 'REQUEST' object (i checked). This leaves two possible sources, a <dtml-in> tag that surrounds 'foo' and through acquisition. Can anyone suggest some strategies for determining where a <dtml-var> is resolving its value from? __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com
At 02:48 PM 2/8/2003, Derek Basch wrote:
Can anyone suggest some strategies for determining where a <dtml-var> is resolving its value from?
First off, are you certain that this mystery variable isn't some "magic" method provided by Zope? You may want to post the name of the variable just to be sure. Assuming that this isn't the case, it can only be coming from four places: 1. It's part of your REQUEST object. 2. It's an object contained by the folder your script is in or any of that folder's parents. 3. It's provided by some object referenced in your URL 4. It's provided by some object you're traversing in the script or are otherwise putting into the namespace There are several things you can do to narrow this down, including: - Comment out all of the script except for that <dtml-var>... is the value still resolved? - Put a method of the same name in the same folder... is that method's value used instead? If so, keep moving the method up the hierarchy until the effect disappears. - If you using a URL that differs from the "physical" path of the object, take a close look at any objects included in the URL. - If commenting everything but the <dtml-var> breaks the variable, pay particular attention to any objects referenced by <dtml-with>, <dtml-in> and (un)restrictedTraverse. Your mysterious name provider probably lurks within. After you've figured out this mess, you should strongly consider re-writing with Python Scripts. DTML should never be used for anything complicated enough to defy easy inspection... but I'll spare you the lecture since you didn't write it. :-) HTH, Dylan
Derek Basch wrote at 2003-2-8 14:48 -0800:
I am currently working with a large DTML script that someone else wrote and I am stuck.
I am trying to determine how a certain <dtml-var foo> is being resolved from the namespace. More precisely, I know that it is not acquiring its value from the 'REQUEST' object (i checked). This leaves two possible sources, a <dtml-in> tag that surrounds 'foo' and through acquisition.
Can anyone suggest some strategies for determining where a <dtml-var> is resolving its value from?
You can distinguish the two cases by accessing the variable outside of the "dtml-in". If this gives you either a KeyError or a different result, the variable is resolved via the variables defined by "dtml-in". Dieter
participants (3)
-
Derek Basch -
Dieter Maurer -
Dylan Reinhardt