[Zope] DTML documents as properties of python product classes

Keith Alperin KAlperin@ignitemedia.com
Mon, 26 Feb 2001 19:51:01 -0600


This is a multi-part message in MIME format.

------_=_NextPart_001_01C0A05F.BC888F7B
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Greetings Zope folks.  I am a bit of a newbie here and am attempting to
use a DTML document as a property of a class of a python product.  To do
so, I have done the following (using the TutorialPoll as my example):

#...snip

    vote_results =3D Globals.HTMLFile("vote_results", globals())

    def castVote(self, choice):
        "Votes for a choice"
        vote_count =3D self.getVotesFor(choice)
        self._votes[choice] =3D vote_count + 1
        return self.vote_results

#the rest of my class


Upon restarting Zope, I get "(This object from the TutorialPoll product
is broken!)" next to my object in the management interface.

Any incite that any of you can provide would be most appreciated.

Thanks so much,
Keith R. Alperin



------_=_NextPart_001_01C0A05F.BC888F7B
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.0.4417.0">
<TITLE>DTML documents as properties of python product classes</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P ALIGN=3DLEFT><SPAN LANG=3D"en-us"><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">Greetings Zope folks.&nbsp; I</FONT></SPAN><SPAN =
LANG=3D"en-us"> <FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">am a bit =
of a newbie here and</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT =
COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">am attempting =
to</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">use a DTML document as a property of a class of a python =
product.&nbsp; To do so, I have done the following (using the =
TutorialPoll as my example):</FONT></SPAN></P>

<P ALIGN=3DLEFT><SPAN LANG=3D"en-us"><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">#&#8230;snip</FONT></SPAN></P>

<P ALIGN=3DLEFT><SPAN LANG=3D"en-us"><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp; vote_results =3D =
Globals.HTMLFile(&quot;vote_results&quot;, globals())</FONT></SPAN></P>

<P ALIGN=3DLEFT><SPAN LANG=3D"en-us"><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp; def castVote(self, =
choice):</FONT></SPAN></P>

<P ALIGN=3DLEFT><SPAN LANG=3D"en-us"><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;Votes =
for a choice&quot;</FONT></SPAN></P>

<P ALIGN=3DLEFT><SPAN LANG=3D"en-us"><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vote_count =3D =
self.getVotesFor(choice)</FONT></SPAN></P>

<P ALIGN=3DLEFT><SPAN LANG=3D"en-us"><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
self._votes[choice] =3D vote_count + 1</FONT></SPAN></P>

<P ALIGN=3DLEFT><SPAN LANG=3D"en-us"><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><S=
PAN LANG=3D"en-us"> <FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">return self.vote_results</FONT></SPAN><SPAN =
LANG=3D"en-us"></SPAN></P>

<P ALIGN=3DLEFT><SPAN LANG=3D"en-us"><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">#the rest of my class</FONT></SPAN></P>
<BR>

<P ALIGN=3DLEFT><SPAN LANG=3D"en-us"><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">Upon restarting Zope, I get &#8220;(This object from the =
TutorialPoll product is broken!)</FONT></SPAN><SPAN LANG=3D"en-us"><FONT =
COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">&#8221; next to my object in =
the management interface.</FONT></SPAN></P>

<P ALIGN=3DLEFT><SPAN LANG=3D"en-us"><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">Any incite that any of you can provide would be most =
appreciated.</FONT></SPAN></P>

<P ALIGN=3DLEFT><SPAN LANG=3D"en-us"><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">Thanks so much,</FONT></SPAN></P>

<P ALIGN=3DLEFT><SPAN LANG=3D"en-us"><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">Keith R. Alperin</FONT></SPAN></P>
<BR>

</BODY>
</HTML>
------_=_NextPart_001_01C0A05F.BC888F7B--