[Zope] lost of namespace problem

Ralf Kraemer ralf.kraemer@smail.inf.fh-rhein-sieg.de
Wed, 18 Apr 2001 23:32:54 +0200


i am playing around with some menu building functions .
the menu is renderd with some recursive calls from an mysql database
everything part alone works fine, but if i put all of the code together 
some hard namespace problems accour, which i cant get fixed !

can anybody help me ????
  I always get some

Error Type: NameError
Error Value: get_menu_nr

Traceback (innermost last):
   File /usr/local/lib/Zope-2.3.1-src/lib/python/ZPublisher/Publish.py, 
line 223, in publish_module
   File /usr/local/lib/Zope-2.3.1-src/lib/python/ZPublisher/Publish.py, 
line 187, in publish
   File /usr/local/lib/Zope-2.3.1-src/lib/python/Zope/__init__.py, line 
221, in zpublisher_exception_hook
     (Object: Traversable)
   File /usr/local/lib/Zope-2.3.1-src/lib/python/ZPublisher/Publish.py, 
line 171, in publish
   File /usr/local/lib/Zope-2.3.1-src/lib/python/ZPublisher/mapply.py, line 
160, in mapply
     (Object: render_menu)
   File /usr/local/lib/Zope-2.3.1-src/lib/python/ZPublisher/Publish.py, 
line 112, in call_object
     (Object: render_menu)
   File /usr/local/lib/Zope-2.3.1-src/lib/python/OFS/DTMLMethod.py, line 
189, in __call__
     (Object: render_menu)
   File 
/usr/local/lib/Zope-2.3.1-src/lib/python/DocumentTemplate/DT_String.py, 
line 538, in __call__
     (Object: render_menu)
   File 
/usr/local/lib/Zope-2.3.1-src/lib/python/DocumentTemplate/DT_Util.py, line 
334, in eval
     (Object: render_path(menu='7'))
     (Info: render_path)
   File <string>, line 0, in ?
   File /usr/local/lib/Zope-2.3.1-src/lib/python/OFS/DTMLMethod.py, line 
182, in __call__
     (Object: render_path)
   File 
/usr/local/lib/Zope-2.3.1-src/lib/python/DocumentTemplate/DT_String.py, 
line 538, in __call__
     (Object: render_path)
   File /usr/local/lib/Zope-2.3.1-src/lib/python/DocumentTemplate/DT_In.py, 
line 649, in renderwob
     (Object: get_menu_nr(menu_nr=menu))
   File 
/usr/local/lib/Zope-2.3.1-src/lib/python/DocumentTemplate/DT_Util.py, line 
334, in eval
     (Object: get_menu_nr(menu_nr=menu))
     (Info: menu)
   File <string>, line 0, in ?
NameError: (see above)




render_menu dtml


<dtml-if res>
   <dtml-in res>
     <dtml-if expr="get_sub_menu(pk_menu_nr=_['sequence-var-menu_nr'])">
      <spacer type=horizontal size=<dtml-var expr="_.int(_.int(ebene)* 10)">>
        <a href="?expand=<dtml-var sequence-var-menu_nr>"><img 
src="gfx/collapse.gif" border=0></a><a 
href="seiten/Pfasssssd"><strong><dtml-var sequence-var-beschriftung> 
</strong></a> <br>
      <dtml-else>
       <spacer type=horizontal size=<dtml-var expr="_.int(_.int(ebene)* 10)">>
   <a href="?expand=1"><img src="gfx/expand.gif" border=0></a> <a 
href="seiten/def/<dtml-var sequence-var-rel_url>"><strong><dtml-var 
sequence-var-beschriftung> </strong></a> <br>
     </dtml-if>
     <dtml-if "_.int(ebene)<=_.int('3')">
          <dtml-let res1="get_sub_menu(pk_menu_nr=_['sequence-var-menu_nr'])">
             <dtml-var "render_menu(res=res1,ebene=_.int(_.int(ebene) + 
_.int(1)))">
          </dtml-let>
        </dtml-if>
   </dtml-in>
<dtml-else>
   <dtml-if ebene>
   <dtml-else>
     <dtml-let res="get_menu">
       <dtml-var "render_menu(res=res,ebene='0')">
                                                                      <---------------------------code 
working point  !!!
     </dtml-let>
   </dtml-if>
</dtml-if>


render_path dtml function

<dtml-comment>
   <dtml-call "REQUEST.set('pfad','')">
</dtml-comment>

<dtml-in "get_menu_nr(menu_nr=menu)">
    <dtml-call "REQUEST.set('pfad',rel_url)">
    <dtml-call "REQUEST.set('pk_nr',pk_menu_nr)">
    <dtml-in "_.range(_.int(ebene))">
      <dtml-in "get_menu_nr(menu_nr=pk_nr)">
        <dtml-call "REQUEST.set('pfad',rel_url + '/'+ pfad)">
        <dtml-call "REQUEST.set('pk_nr',pk_menu_nr)">
      </dtml-in>
    </dtml-in>

</dtml-in>
<dtml-return pfad>


the problem accurs when i use one these calls in the code
<dtml-call expr="render_path(menu='7')">
<dtml-var URL1>


if i put them after the
       <dtml-var "render_menu(res=res,ebene='0')">
line everything works ,
can anybody explain it to me ????

i searched the zope book and th howto#s and the mailing list and cant find 
any real hint ...