[Zope] Poor Procedural Programmer Needs OOPish Enlightenment

sean.upton@uniontrib.com sean.upton@uniontrib.com
Wed, 03 Jan 2001 19:03:37 -0800


Not sure if this is your problem, but since methods don't have namespaces,
I'm not sure why your code could not be reduced to:

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

The namespace of index_html right now is 'edit' (or another folder that
acquires it)

...and...

if the namespace of index_html is 'edit' than the namespace of index.html
will also be, and ergo, the namespace of chunk_dspPrimaryCol will also be
edit (index.html doesn't have a method unto itself), changing your code to:

<dtml-if expr="id != 'edit'">
  <dtml-var chunk_dspPrimaryColPublic>
<dtml-else>
  <dtml-var chunk_dspPrimaryColEdit>
</dtml-if>

Just keep in mind, that any object with a namespace (folders, documents,
certain class instances) that is in the acquisition path can have that
namespace explicitly invokes with <dtml-with name_of_object>.  This only
works for object with a namespace; methods are not acquirable objects, and
though you might call them objects (in a loose sense) they are not objects
in a Zopish sense.

I don't know if my sugestion will work for you, but hopefully it will help.

Sean

=========================
Sean Upton
Senior Programmer/Analyst
SignOnSanDiego.com
The San Diego Union-Tribune
619.718.5241
sean.upton@uniontrib.com
=========================


-----Original Message-----
From: Geoffrey L. Wright [mailto:gwright@integritysi.com]
Sent: Wednesday, January 03, 2001 3:16 PM
To: zope@zope.org
Subject: [Zope] Poor Procedural Programmer Needs OOPish Enlightenment



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


_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )