[Zope] - Is this a bug?

Jim Fulton jim@Digicool.com
Mon, 14 Dec 1998 12:26:11 +0000


Butch Landingin wrote:
> 
> I've just started playing around with Zope and the Plutonia example so
> I don't know enough to figure this one out:
> 
> I defined the standard_html_header as follows :
> 
> ---start of standard_html_header--------
> 
> <HTML><HEAD>
>    <TITLE><!--#var document_title--></TITLE>

This will display the document_title of
standard_html_header, which is probably
blank. :)


>    </HEAD>
>    <BODY BGCOLOR="#FFFFFF">
>    <P><!--#var PlutoniaLogo--></P>
> 
> ---end of standard_html_header--------
> 
> and in each of the the folders News, Products and Research,
> there an index_html (e.g. title : Plutonia News) with the following
> text (or something like it) :
> 
> -----start of index_html---------
> 
> <!--#var standard_html_header-->
> <H2> <!--#var document_title--></H2>
> <P> Welcome to Plutonia News Section!</P>
> <P> We don't have any news items to report yet though. </P>
> <!--#var standard_html_footer-->
> 
> -----end of index_html---------
> 
> When the page is rendered, the document_title is displayed correctly
> as <H2> Plutonia News </H2>.
> However the standard_html_header template expansion has this quirky
> behavior :
> the PlutoniaLogo is translated correctly into PlutoniaLogo but the
> document_title in between the <TITLE> tags is empty!
> 
> See the rendered HTML:
> 
> ---start of rendered HTML --------
> 
> <HTML><HEAD>
>    <TITLE></TITLE>
>    </HEAD>
>    <BODY BGCOLOR="#FFFFFF">
>    <P><IMG SRC="PlutoniaLogo" ALT="PlutoniaLogo"></P>
> <H2> Plutonia News</H2>
> <P> Welcome to Plutonia News Section!</P>
> <P> We don't have any news items to report yet though.</P>
> </BODY></HTML>
> 
> ---end of rendered HTML --------
> 
> Question: What's the difference in evaluating the document_title
> inside standard_html_header and evaluating it inside index_html ? 

No difference.  It always displays the title of the document
being rendered.

> Is
> there no dynamic or recursive expansion of variables at all?

Yes.

> Is there anything that I'm missing here?

Yes, it subtle and most people miss it, which is 
why we're going to change the software. :)

> If there is no recursive expansion of
> variables, is there anyway I can put a dynamically evaluated variable
> in the standard_html_header so that it displays the correct title?

The problem is that documents are *really* methods, but people
often want to use them as data.  Then again, sometimes you want them 
to act like methods.

In this example, you want index_html to act like data, with it's own
properties (e.g. title). OTOH, you want standard_html_header to act like
a method and displat the title of index_html, not it's own title
(or the title of the folder).

I plan to fix this by:

  - Renaming the current document objects to "DTML Methods".

  - Create a new object type: "DTML Documents".  These objects
    will let you define more or less arbitrary properties and
    will display their own properties rather than folder properties 
    first.
 
> Other than this, I think Zope is pretty cool.

Cool!

Jim

--
Jim Fulton           mailto:jim@digicool.com
Technical Director   (540) 371-6909              Python Powered!
Digital Creations    http://www.digicool.com     http://www.python.org

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.