[Zope] dtml/namespace problem

Alan Pogrebinschi alanpog@empresa.net
Mon, 6 Dec 1999 18:09:30 -0200


This is a multi-part message in MIME format.

------=_NextPart_000_0101_01BF4015.0A79AB60
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi.

I have always been able to nest dtml methods inside the same folder or =
calling methods within the  acquisition hierarchy (upward) , one calling =
another, calling another, etc

But now I cannot make this same process work when I try it using =
different levels of folder hierachy (downards):

A simple example:

/
|
- testroot (dtml method)
|
+ input (Folder)
     |
     -- test1 (dtml method)
     |
     -- test2 (dtml method)


The contents are the following (all are one-liners):

1) testroot (at the root folder):

<dtml-var "input.test1()">

Note: If I try w/o the quotes and parenthesis then it does not recognize =
'input.test'. Is this supposed to work like this?


2) test1(at the 'input' folder):

<dtml-var test2>

Note: I tried to add quotes and parenthesis but it made no difference =
here. I also tried to fully qualify the variable, making it =
'intput.test2' because I thought that maybe it was evaluating it from =
the perspective of the caller, which is in the root folder. But this did =
not work either.


3) test2 (at the 'input' folder):
<h2>Hello!</h2>


I always get an error when calling /testroot . The error and traceback =
is:

Error Type: KeyError
Error Value: test2

Traceback (innermost last):
  File /usr/local/zope210/lib/python/ZPublisher/Publish.py, line 214, in =
publish_module
  File /usr/local/zope210/lib/python/ZPublisher/Publish.py, line 179, in =
publish
  File /usr/local/zope210/lib/python/Zope/__init__.py, line 202, in =
zpublisher_exception_hook
    (Object: ElementWithAttributes)
  File /usr/local/zope210/lib/python/ZPublisher/Publish.py, line 165, in =
publish
  File /usr/local/zope210/lib/python/ZPublisher/mapply.py, line 160, in =
mapply
    (Object: testroot)
  File /usr/local/zope210/lib/python/ZPublisher/Publish.py, line 102, in =
call_object
    (Object: testroot)
  File /usr/local/zope210/lib/python/OFS/DTMLMethod.py, line 145, in =
__call__
    (Object: testroot)
  File /usr/local/zope210/lib/python/DocumentTemplate/DT_String.py, line =
502, in __call__
    (Object: testroot)
  File /usr/local/zope210/lib/python/DocumentTemplate/DT_Util.py, line =
335, in eval
    (Object: input.test1())
    (Info: input)
  File &lt;string&gt;, line 0, in ?
  File /usr/local/zope210/lib/python/OFS/DTMLMethod.py, line 141, in =
__call__
    (Object: test1)
  File /usr/local/zope210/lib/python/DocumentTemplate/DT_String.py, line =
502, in __call__
    (Object: test1)
KeyError: (see above)

Using Zope 2.1.0 final.


Where am I wrong??

Thanks.

Alan


------=_NextPart_000_0101_01BF4015.0A79AB60
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>Hi.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>I have always been able to nest dtml methods inside =
the same=20
folder or&nbsp;calling methods&nbsp;within the&nbsp; acquisition =
hierarchy=20
(upward) , one calling another, calling another, etc</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>But now I cannot make this same process work when I =
try it=20
using different levels of folder hierachy (downards):</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>A simple example:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>/</FONT></DIV>
<DIV><FONT size=3D2>|</FONT></DIV>
<DIV><FONT size=3D2>- testroot (dtml method)</FONT></DIV>
<DIV><FONT size=3D2>|</FONT></DIV>
<DIV><FONT size=3D2>+ input (Folder)</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp;&nbsp; |</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp;&nbsp; -- test1 (dtml =
method)</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp;&nbsp; |</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp;&nbsp; -- test2 (dtml =
method)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>The contents are the following (all are=20
one-liners):</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>1) testroot (at the root folder):</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>&lt;dtml-var "input.test1()"&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>Note: If I try w/o the quotes and parenthesis then =
it does not=20
recognize 'input.test'. Is this supposed to work like this?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>2) test1(at the 'input' folder):</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>&lt;dtml-var test2&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>Note: I tried to add quotes and parenthesis but it =
made no=20
difference here. I also tried to fully qualify the variable, making it=20
'intput.test2' because I thought that maybe it was evaluating it from =
the=20
perspective of the caller, which is in the root folder. But =
this&nbsp;did not=20
work either.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>3) test2 (at the 'input' folder):</FONT></DIV>
<DIV><FONT size=3D2>&lt;h2&gt;Hello!&lt;/h2&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>I always get an error when calling /testroot . The =
error and=20
traceback is:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>
<P><STRONG>Error Type: KeyError</STRONG><BR><STRONG>Error Value:=20
test2</STRONG></P>
<P>Traceback (innermost last):<BR>&nbsp; File=20
/usr/local/zope210/lib/python/ZPublisher/Publish.py, line 214, in=20
publish_module<BR>&nbsp; File=20
/usr/local/zope210/lib/python/ZPublisher/Publish.py, line 179, in=20
publish<BR>&nbsp; File /usr/local/zope210/lib/python/Zope/__init__.py, =
line 202,=20
in zpublisher_exception_hook<BR>&nbsp;&nbsp;&nbsp; (Object:=20
ElementWithAttributes)<BR>&nbsp; File=20
/usr/local/zope210/lib/python/ZPublisher/Publish.py, line 165, in=20
publish<BR>&nbsp; File =
/usr/local/zope210/lib/python/ZPublisher/mapply.py, line=20
160, in mapply<BR>&nbsp;&nbsp;&nbsp; (Object: testroot)<BR>&nbsp; File=20
/usr/local/zope210/lib/python/ZPublisher/Publish.py, line 102, in=20
call_object<BR>&nbsp;&nbsp;&nbsp; (Object: testroot)<BR>&nbsp; File=20
/usr/local/zope210/lib/python/OFS/DTMLMethod.py, line 145, in=20
__call__<BR>&nbsp;&nbsp;&nbsp; (Object: testroot)<BR>&nbsp; File=20
/usr/local/zope210/lib/python/DocumentTemplate/DT_String.py, line 502, =
in=20
__call__<BR>&nbsp;&nbsp;&nbsp; (Object: testroot)<BR>&nbsp; File=20
/usr/local/zope210/lib/python/DocumentTemplate/DT_Util.py, line 335, in=20
eval<BR>&nbsp;&nbsp;&nbsp; (Object: input.test1())<BR>&nbsp;&nbsp;&nbsp; =
(Info:=20
input)<BR>&nbsp; File &amp;lt;string&amp;gt;, line 0, in ?<BR>&nbsp; =
File=20
/usr/local/zope210/lib/python/OFS/DTMLMethod.py, line 141, in=20
__call__<BR>&nbsp;&nbsp;&nbsp; (Object: test1)<BR>&nbsp; File=20
/usr/local/zope210/lib/python/DocumentTemplate/DT_String.py, line 502, =
in=20
__call__<BR>&nbsp;&nbsp;&nbsp; (Object: test1)<BR>KeyError: (see =
above)</P>
<P>Using Zope 2.1.0 final.</P></DIV>
<DIV>&nbsp;</DIV>
<DIV>Where am I wrong??</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Alan</DIV>
<DIV></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0101_01BF4015.0A79AB60--