Zope cannot find the tutorial examples. You should install the tutorial examples before continuing. Choose "Zope Tutorial" from the product add list in the Zope management screen to install the examples.
If you have already installed the tutorial, you can either follow along manually, or reinstall the tutorial examples. Note: make sure that you have cookies turned on in your browser.Now that we have a working photo archive, let's enhance it to handle submissions from site visitors.
Viewtab to view it.
lesson8folder in the Zope management screen using your browser's back button.
photoArchivefolder to enter it.
Notice that there is now a new Image object in the folder. This image was created when you uploaded your photo.
Let's investigate how this works, and add the ability to give our uploaded photo a title.
<dtml-var standard_html_header> <h2><dtml-var title></h2> <p>Upload a picture to the Elvis Photo Archive.</p> <form action="photoAction" method="post" enctype="multipart/form-data"> <p>Title: <input type="text" name="photo_title"></p> <p>File: <input type="file" name="file"></p> <input type="submit"> </form> <dtml-var standard_html_footer>
This document collects data needed to create an Image. It calls the
photoAction document with that data. The
actually creates the Image. Now let's customize the
document to handle the image title.
photoActiondocument to edit it.
<dtml-var standard_html_header> <h2><dtml-var title></h2> <dtml-call expr="photoArchive.manage_addImage( id='', file=file, title=photo_title)"> <p>Thanks for your photo submission.</p> <dtml-var standard_html_footer>
photoAction document uses the <dtml-call> tag to
perform an action without inserting anything into the web page. It
manage_addImage method on the
manage_addImage is a folder method that creates a new
You can use forms to pass information between Zope objects. You can programmatically create new Zope objects.
In the next lesson you'll learn about HTTP Cookies and personalizing your web site.
Comments on this lesson? Email feedback.