[ZDP] Extending Zope - Repeating the steps outline in the text,
pointing out errors and asking questions
tsnell at enervation.com
Fri Sep 26 12:39:31 EDT 2003
Creating Zope Products
Product Management folder: Click on the Control_Panel in the root
folder and then click Products
Creating A Simple Product
2 click the Add Product button on the Product Management folder
(Product add form)
Enter the id "ZooExhibit" and click Generate. ( Product at
4 Select the ZooExhibit Product.
In the Contents View create a DTML Method named hello with these
contents: (insert code from text box)
Select Zope Factory from the product add list.
Give your Factory an id of myFactory
In the Add list name field enter Hello and in the Method selection,
choose hello. ( Zope Factory at
Go to the root folder and click the product add list. Notice that it
now includes an entry named Hello.
create a new Folder named exhibitTemplate in your Product.
Also in the Product folder ( Product at
/Control_Panel/Products/ZooExhibit) create a DTML Method named addForm,
and Python Script named add.
go back to your Factory and change it so that the Add list name is Zoo
Exhibit and the method is addForm.
The next step is to edit the addForm method to have these contents:
(insert code from text box)
Now paste the following body into the add script: (If you paste in with
the first three '##' lines, you get an
error. Remove those lines and set the parameters in the 'Parameters'
form field above the window. Omit "Parameters=" and only insert "id
,title, REQUEST=None") Text not clear
Switch to the "Test" tab. This calls a view requesting values for the
parameters. Provide an "id" value and a "Title" value.
rename the existing ZooExhibit Product in your Zope Products folder to
something else, like ZooTemplate so that it does not conflict with this
create a new Product in the Product folder called ZooExhibit.
Go into the ZooExhibit Product you just created and elect ZClass from the add list of the
ZooExhibit Contents view and go to the ZClass add form.
For ID choose the name ZooExhibit
For Meta Type choose the name ZooExhibit
Constructor objects: leave this box checked.
persistent object base classes: leave this box checked.
Now click Add.
Click on the new ZClass and click on its Basic tab. (This step only
requires reading. No new object is created)
go to your root folder
select Folder from the add list and create a new folder with the id
click on the Exhibits folder you just created and
Go ahead and select ZooExhibit from the add list and create a new
Exhibit with the id "FangedRabbits".
select it by clicking on it. (No action is required here.)
Creating Views of Your ZClass
30 Go to your ZooExhibit ZClass and click on the Views tab. ( Z Class
at /Control_Panel/Products/ZooExhibit/ZooExhibit/propertysheets/views )
Note: The following sentence is incorrect: " The Method column on the
Methods view has select boxes that let you choose which method generates
which view. The method associated with a view can be either an object in
the Methods view, or a Property Sheet in the Property Sheets view." It
might better read: "The Method column on this view has drop down menues
which can be activated using the select boxes on the far left."
"The method associated with a view can be either an object in the
Methods view, or a Property Sheet in the Property Sheets view."
Separate paragraph recommended
Creating Properties on Your ZClass
31 Go to your ZooExhibit ZClass and click on the Property Sheets tab.
To create a new sheet, click Add Common Instance Property Sheet. This
will take you to the Property Sheet add form.
Call your new Property Sheet "ExhibitProperties" and click Add.
Click on the new sheet to manage it, as shown in [12-6]
Create three new properties on this sheet: animal (type string),
description (type text), caretakers (type lines)
return to the ZooExhibit ZClass and click on the Views tab.
create a new view with the name Edit
Associate it with the method propertysheets/ExhibitProperties/manage_edit.
Now, go back to your Exhibits folder and look at an existing
ZooExhibit "FangedRabbit" instance. a new view called Edit has been
added to your object, as shown in Figure [12-7]
(ZooExhibit at /Exhibits/FanggedRabbits/propertysheets/ExhibitProperties )
Note: Figure 12-7 contains a link which is not in comformance with the
text. The reader has been instructed to create an instance
"FangedRabbit", not "ZooExhibit". The "Edit" view can be found under
"View" in FangedRabbit.
on the Edit view for your ZooExhibit FangedRabbit instance (not the
"Fanged Rabbit" for the animal property,
the description "Fanged, carnivorous rabbits plagued early medieval
knights. They are known for their sharp, pointy teeth." and
two caretakers, "Tim" and "Somebody Else".
Now click Save Changes.
Go back to the ZooExhibit ZClass and look at the ExhibitProperties
Property Sheet. (No action is required, the point is that the Z Class
was not effected by the changes made in the instance.)
provide default values for properties on a Property Sheet. enter the
text "Describe your exhibit in this box" in the description property of
the ZooExhibit ZClass. (in the text this is merely a suggestion, not an
instruction. However, if not followed the subsequent instructions do
not produce the desired results.)
Reformulate to make it an instruction
Click "Save changes" (this instruction is missing in the text).
go back to your Exhibits folder and
create a new , ZooExhibit object,
supply the ID "Elephant" or some other appropriate name (this
instruction is not contained in the text)
Save it (this instruction is not contained in the text)
click on it and (this instruction is not contained in the text)
click on its Edit view. superfluous comma (,),
go back to your ZClass and
click on the Views tab and
check the box to change the "Edit" view to be the first view
by clicking the First button.
Creating Methods on your ZClass
Go to your ZooExhibit ZClass and click on the Methods tab. ( Z Class
at /Control_Panel/Products/ZooExhibit./ZooExhibit/propertysheets/methods )
Create a new DTML Method on the Methods tab of your ZooExhibit ZClass
Put the following DTML in the index_html Method you just created:
(insert code from text box)
TO THIS POINT EVERYTHING WORKS, IF THE READER CAN FIGURE OUT WHAT IS
HOWEVER, THERE IS NO EXPLANATION OF HOW TO USE index_html. THEREFORE,
THERE IS NO WAY TO LOOK AT FangedRabbits or my Elephant pages. SO THE
NET RESULT IS: NO PRODUCT!
THE FOLLOWING POINTS DO NOT WORK. 48 - 53
visit one of your ZooExhibit instances directly through the web, for
Unfortunately this does not work, probably because the "Zoo" is not
available now at "www.zopezoo.org"
Mess. Does not work
To create the isHungry method, first create two new properties in the
ExhibitProperties property sheet
named "last_meal_time" that is of the type date (enter a date on the
last_meal_time property in the following format: 2002/08/20 13:00:00
"isDangerous" that is of the type boolean.
Half the points are in reader comments, not the text
implementation of the isHungry method in Python: (the text does not
spell out the steps here and leave the newbee in the lurch. Presumably
they are as follows:)
a) Return to your Product folder ZooExhibit (the container, as the text
b) From the add list select DTML Method
c) Name it isHungry
d) Click on isHungry
e) Copy the Python script from the text box.
Point 50 has been created by me.
Go to your index_html and click on it.
Point 51 has been created by me.
From the text box preceeded by the text "you could improve the hunger
display like so:" copy that text, then return to index_html and prepare
to insert it.
Point 52 has been created by me.
Insert the code in front of <dtml-var standard_html_footer>, then enter
a carriage return.
Point 52 has been created by me.
It does not work
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ZDP