[Zope] NameError, namespace-Problem?

Casey Duncan cduncan@kaivo.com
Wed, 20 Jun 2001 09:39:59 -0600


Andreas H=F6lzl wrote:
>=20
> please allow me to post this previously posted mail again.
> the underlaying problems seems to be crucial for my understanding of
> Zope.
>=20
> I have a serious namespace-problem when trying to put serveral
> dtml/zsql-methods together in one rendering act.
>=20
> the problem:
>=20
> first of all i try to render a dtml-method "base_method" located in
> "/root/subfolder/subsubfolder" via URL.
>=20
> "base_method" is a layout template.
> inside "base_method" i call the dtml-method "db_query" located in
> "/root/subfolder/db_stuff" (!) for the output of a more complex
> db-query :
> ...
>   <dtml-with db_stuff>
>     <dtml-var "db_query(...)">
>   </dtml-with>
> ...
>=20
> Zope finds "db_query" in "db_stuff" and renders it, but is not able to
> call zsql-methods also located in the same directory
[snip]


This is probably because you are not passing the namespace to the DTML
method. You need to do this explicitly when you call a DTML object in an
expression. It is done for you when you call one by name. Try the
following:

  <dtml-with db_stuff>
     <dtml-var "db_query(_.None,_,...)">
   </dtml-with>

This will pass the namspace (through the _ variable) to your dtml method
which should allow it to find the other objects in the db_stuff folder
and elsewhere.

hth,
--=20
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>