[Zope] Newbie: namespace in DTML-methods

Thomas Weholt t-weh@online.no
Wed, 24 Jul 2002 22:20:48 +0200


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