<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
<h3> Creating Methods on your ZClass</h3>
The text reads (as corrected by various readers): <br>
<br>
Create a new DTML Method on the <em>Methods</em> tab of your <em>ZooExhibit</em>
ZClass called <em>index_html</em>.<br>
... Put the following DTML in the <em>index_html</em> Method you just
created:
<blockquote>&lt;dtml-var standard_html_header&gt;<br>
  <br>
&lt;h1&gt;&lt;dtml-var animal&gt;&lt;/h1&gt;<br>
  <br>
&lt;p&gt;&lt;dtml-var description&gt;&lt;/p&gt;<br>
  <br>
&lt;p&gt;The &lt;dtml-var animal&gt; caretakers are:&lt;br&gt;<br>
&lt;dtml-in caretakers&gt;<br>
&lt;dtml-var sequence-item&gt;&lt;br&gt;<br>
&lt;/dtml-in&gt;<br>
&lt;/p&gt;<br>
</blockquote>
<pre class="simple_example">&lt;dtml-var standard_html_footer&gt;
</pre>
At this point this returns an error, because <font color="#3333ff">"animal"
is not found in the Propertysheets</font>.<br>
<br>
The text continues, suggesting a test be entered in your browser: <em><a
 class="moz-txt-link-freetext"
 href="http://www.zopezoo.org/Exhibits/FangedRabbits/">http://www.zopezoo.org/Exhibits/FangedRabbits/</a>.&nbsp;
<font color="#3333ff"><i>This site does not exist.&nbsp; Therefore, the test
flops.</i></font></em><br>
<br>
"To create the <em>isHungry</em>
method, <br>
a) first create two new properties in the <em>ExhibitProperties</em>
property sheet <br>
named "last_meal_time" that is of the type <em>date</em> (<span
 style="font-family: monospace;">enter a date on the last_meal_time
property in the following format: 2002/08/20 13:00:00 GMT+9)and<br>
b)"isDangerous" that is of the type boolean.<br>
<br>
The above </span> <em>isHungry </em><span
 style="font-family: monospace;">text is no longer problematical.&nbsp; It
continues, however, with:<br>
<br>
</span> Here is an example of an implementation of the <em>isHungry</em>
method in Python: <br>
<br>
<blockquote>## Script (Python) "isHungry"<br>
##<br>
"""<br>
Returns true if the animal hasn't eaten in over 8 hours<br>
"""<br>
from DateTime import DateTime<br>
if (DateTime().timeTime() <br>
- container.last_meal_time.timeTime() &gt; 60 * 60 * 8):<br>
return 1<br>
else:<br>
</blockquote>
<pre class="simple_example">    return 0</pre>
The above comment is not an instruction to a student of Zope.&nbsp; It says
it is an example of code.&nbsp; What should the instruction look like
please?&nbsp; I tried the following logic:<br>
a) Return to your Product folder ZooExhibit (the container, as the text
points out).<br>
b) From the add list select DTML Method<br>
c) Name it <span style="font-style: italic;">isHungry and save it<br>
</span>d) Click on<span style="font-style: italic;"> isHungry<br>
</span>e) Copy the Python script from the text box and save it.<br>
<br>
This cannot be tested alone, because it merely checks the time and
passes on a parameter to another script.&nbsp; Thus, the text continues:<br>
You could call this method from your <em>index_html</em> display
method using this snippet of DTML:<br>
<blockquote>&lt;dtml-if isHungry&gt;<br>
&lt;p&gt;&lt;dtml-var animal&gt; is hungry&lt;/p&gt;<br>
</blockquote>
<blockquote>
  <pre class="simple_example">&lt;/dtml-if&gt;</pre>
</blockquote>
<font color="#3333ff">"animal" does not exist</font> anywhere.<br>
<br>
I do not know what to do with the "animal".&nbsp; Should this call be
something like:<br>
&lt;p&gt;&lt;dtml-var animal&gt; is hungry&lt;/p&gt;<br>
<br>
<br>
</body>
</html>