[Zope] Poor Procedural Programmer Needs OOPish Enlightenment

Geoffrey L. Wright gwright@integritysi.com
03 Jan 2001 14:15:30 -0900


or...

"A Cry for Namespace Help"


I seem to have run into one of those Zope namespace issued that's
starting to make me dizzy.

I have a index_html method that displays content conditionally
depending on where it's called.  It looks like this:


<dtml-if expr="PARENTS[0].id != 'edit'">
  <dtml-var index.html>
<dtml-else>
  <dtml-var chunk_editFrameset>
</dtml-if>

The chunk_editFrameset method also displays the same index.html file in
one of two frames.  This works like a champ.  If I'm in a directory
called edit when this is called, it displays the frameset.  Otherwise,
it displays the index.html directly.

The index.html method is contains a bunch 'o static html plus another
method called chunk_dspPrimaryCol that also conditionally displays
information based on where it's called.  chunk_dspPrimaryCol looks like
this:

<dtml-if expr="PARENTS[0].id != 'edit'">
  <dtml-var chunk_dspPrimaryColPublic>
<dtml-else>
  <dtml-var chunk_dspPrimaryColEdit>
</dtml-if>

This doesn't work like I'd hoped, since I have to move back up the
namespace stack to find index.html, and by the time I do I'm no longer
in the edit folder.  So I _always_ end up displaying the
chunk_dspPrimaryColPublic method, even if I call the index_html method
from within the edit folder.

What I need (I think) is a way to keep all of this activity in the
edit Folder.  Or I need some other way of solving this problem.  Any
thoughts?  I hope my description was clear enough...


-- 
Geoffrey L. Wright
Developer / Systems Administrator

(907) 563-2721 ex. 4900
http://www.integritysi.com