[Zope] Poor Procedural Programmer Needs OOPish Enlightenment

2001-01-03 Thread Geoffrey L. Wright


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  -  [EMAIL PROTECTED]
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 )




RE: [Zope] Poor Procedural Programmer Needs OOPish Enlightenment

2001-01-03 Thread sean . upton

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
[EMAIL PROTECTED]
=


-Original Message-
From: Geoffrey L. Wright [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 03, 2001 3:16 PM
To: [EMAIL PROTECTED]
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  -  [EMAIL PROTECTED]
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 )

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Poor Procedural Programmer Needs OOPish Enlightenment

2001-01-03 Thread Geoffrey L. Wright

[EMAIL PROTECTED] writes:

 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

You're right -- this works just as well, and is much cleaner.  And I
figured out my problem while yanking out another unneeded reference to
PARENTS.  In my framset code I had a reference to PARENTS[1] (not
[0]!), so I was forcing Zope to look at the index.html method from the
namespace of the test_site folder.  DOH!

Zope is a funny thing -- it makes some things so much easier, but I
always find myself getting tangled up in stooopid namespace problems
of my own making.  I guess I'm just not used to thinking this way yet.

Many thanks for the assist.

 Sean

//glw


___
Zope maillist  -  [EMAIL PROTECTED]
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 )