This is the contents of a DTML-method, defined in the root-folder : <dtml-with expr="PARENTS[1-]"> <dtml-in expr="SQL.sqlmViewComments(com_object=com_object, com_object_id=com_object_id)"> <!-- process the result-set --> </dtml-in> </dtml-with> When called in a DTML-document in a sub-folder below the root-folder I get an error saying "global name 'PARENTS' not defined". Calling the method from the root-folder or testing it using the ZMI produces no such error. The purpose is to have a DTML-method I can use site-wide that uses SQL-methods in a folder called SQL located in the root-folder. This is sort of a follow-up to my earlier question, "Newbie: One location for SQL-methods site-wide". I've tried some of the proposed solutions, like http://www.zopelabs.com/cookbook/1003151229, but, as said above, it works fine using it in the root-folder, not in sub-folders. I've also tried to pass the PARENTS-variable as an argument to the DTML-method with no luck. It seems as if the namespace is different in the DTML-method and the DTML-document that use it. How can I pass on required variables to the method to get it to work site-wide? Thanks for all your help so far :-) Best regards, Thomas
Thomas Weholt writes:
This is the contents of a DTML-method, defined in the root-folder :
<dtml-with expr="PARENTS[1-]"> This should be: "PARENTS[-1]", right?
I am a bit picky when I see problem reports that seem not be prepared with great care...
<dtml-in expr="SQL.sqlmViewComments(com_object=com_object, com_object_id=com_object_id)"> <!-- process the result-set --> </dtml-in> </dtml-with>
When called in a DTML-document in a sub-folder below the root-folder I get an error saying "global name 'PARENTS' not defined". Almost surely, you forget the essential two positional parameters for calls of DTML objects...
Read "Calling DTML objects" in <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html> Dieter
participants (2)
-
Dieter Maurer -
Thomas Weholt