[Zope] How to disply a property of an object created with a Z class
pieter claassen
pieter@pieterclaassen.co.uk
Sun, 26 Jan 2003 23:12:25 -0000
This is a multi-part message in MIME format.
------=_NextPart_000_000C_01C2C590.6679DC60
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
I used a Z class to write a basic news pinup board for my site.
Everything is working fine but I reached a point where I am trying to
publish only the heading and a summary of the message while asking users
to click on a link to view the body of the message
I have created a newster class which is my news server instance. The
newster class contains the messages class which is the blueprint for
each of the messages that I am going to add. Each message is an object
in the newster directory.
The message objects each have a number of properties such as expired,
title, id, summary and body.
I have two methods:
1. index_html that prints the title and summary of each message instance
one after the other on a long page.
2. display_body that will print the body of the message in a new window.
The problem:
I pass the id of the message whose body must be displayed in a url like:
display_body?document_id=<id>
Here is what I believe the basic code of the display_body method should
be:
<dtml-var standard_html_header>
<dtml-with REQUEST>
<dtml-with expr="document_id">
<dtml-var body>
</dtml-with>
</dtml-with>
<dtml-var standard_html_footer>
I can print the document_id as a dtml-var but somehow I cannot get zope
to understand it is the name of an object whose body property I want to
display.
But, somehow, zope does not push the properties of the document_id
(which it received through the web) on top of the namespace and
therefore it believes that there is no such thing as a body property.
Any help will be greatly appreciated. This is driving me nuts.
Thanks,
Pieter
------=_NextPart_000_000C_01C2C590.6679DC60
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)">
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.EmailStyle17
{font-family:Arial;
color:windowtext;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=3DEN-US link=3Dblue vlink=3Dpurple>
<div class=3DSection1>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>I used a Z class to write a basic news pinup =
board
for my site. Everything is working fine but I reached a point where I am =
trying
to publish only the heading and a summary of the message while asking =
users to
click on a link to view the body of the message</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>I have created a newster class which is my =
news
server instance. The newster class contains the messages class which is =
the
blueprint for each of the messages that I am going to add. Each message =
is an
object in the newster directory.</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>The message objects each have a number of =
properties
such as expired, title, id, summary and body.</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>I have two methods:</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>1. index_html that prints the title and =
summary of
each message instance one after the other on a long =
page.</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>2. display_body that will print the body of =
the
message in a new window.</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>The problem:</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>I pass the id of the message whose body must =
be
displayed in a url like: =
display_body?document_id=3D<id></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>Here is what I believe the basic code of the =
display_body
method should be:</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'><dtml-var =
standard_html_header></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'><dtml-with REQUEST></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'><dtml-with =
expr=3D"document_id"></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'><dtml-var body></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'></dtml-with></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'></dtml-with></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'><dtml-var =
standard_html_footer></span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>I can print the document_id as a dtml-var but =
somehow
I cannot get zope to understand it is the name of an object whose body =
property
I want to display.</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>But, somehow, zope does not push the =
properties of
the document_id (which it received through the web) on top of the =
namespace and
therefore it believes that there is no such thing as a body =
property.</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>Any help will be greatly appreciated. This is =
driving
me nuts.</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>Thanks,</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span lang=3DEN-GB =
style=3D'font-size:
10.0pt;font-family:Arial'>Pieter</span></font></p>
</div>
</body>
</html>
------=_NextPart_000_000C_01C2C590.6679DC60--