"global name 'REQUEST' is not defined"
Hello, all, Once again, it seems I must be misunderstanding something very basic. I have a DTML method that's being called from a DTML document, and it contains the code: <dtml-if expr="REQUEST.get(field_var)"> ... </dtml-if> where field_var is a dtml variable that has been set to the name of another dtml variable that certainly exists in the parent document. For example, field_var == "lastname", and the parent DTML document has either received "lastname=Blah" in its request, or has done "REQUEST.set('lastname','')" if not. But the code above yeilds an error: "global name 'REQUEST' is not defined". Since it's defined in the parent document, shouldn't it also be defined for the DTML method? According to "The Book of Zope" the REQUEST object is defined "for the duration of the web request"; surely that must include the invocation of DTML methods within the target document? Thanks in advance, -- Joe "I should like to close this book by sticking out any part of my neck which is not yet exposed, and making a few predictions about how the problem of quantum gravity will in the end be solved." --- Physicist Lee Smolin, "Three Roads to Quantum Gravity"
Er... OK... It works fine if I use a DTML /document/ rather than a DTML /method/. So are DTML methods totally useless or what? </flamebait> Cheers, -- Joe Joseph A Knapka wrote:
Hello, all,
Once again, it seems I must be misunderstanding something very basic. I have a DTML method that's being called from a DTML document, and it contains the code:
<dtml-if expr="REQUEST.get(field_var)"> ... </dtml-if>
where field_var is a dtml variable that has been set to the name of another dtml variable that certainly exists in the parent document. For example, field_var == "lastname", and the parent DTML document has either received "lastname=Blah" in its request, or has done "REQUEST.set('lastname','')" if not. But the code above yeilds an error:
"global name 'REQUEST' is not defined".
Since it's defined in the parent document, shouldn't it also be defined for the DTML method? According to "The Book of Zope" the REQUEST object is defined "for the duration of the web request"; surely that must include the invocation of DTML methods within the target document?
Thanks in advance,
-- Joe "I should like to close this book by sticking out any part of my neck which is not yet exposed, and making a few predictions about how the problem of quantum gravity will in the end be solved." --- Physicist Lee Smolin, "Three Roads to Quantum Gravity"
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- "I should like to close this book by sticking out any part of my neck which is not yet exposed, and making a few predictions about how the problem of quantum gravity will in the end be solved." --- Physicist Lee Smolin, "Three Roads to Quantum Gravity"
Joseph A Knapka writes:
Once again, it seems I must be misunderstanding something very basic. I have a DTML method that's being called from a DTML document, and it contains the code:
<dtml-if expr="REQUEST.get(field_var)"> ... </dtml-if> Please read the section "Calling DTML objects" in
<http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html> Dieter
participants (2)
-
Dieter Maurer -
Joseph A Knapka