Zope Problem Set 1: Basic

by Zvi Boshernitzan


Requirements

You should already be familiar with html, and have programmed in a scripting language.

Objectives

By doing this problem set you will learn
  1. How to install and log into Zope.
  2. How to manage simple static content.
  3. How to write simple dynamic pages using the DTML templating facility of zope.
  4. How to create, execute, test, and debug a python script.
  5. How to write a python page that queries a foreign server
  6. How to query the Object Database through Zope's Management Interface

Resources

  • Download Zope
  • Documentation
  • Livewires Python Worksheets
  • Python for the Impatient
  • Zope Book
    1. Preface
    2. Introducing Zope
    3. Using Zope
    4. Using Basic Zope Objects
    5. Dynamic Content with DTML
    6. Using Zope Page Templates
    7. Creating Basic Zope Applications
    8. Users and Security
    9. Variables and Advanced DTML
    10. Advanced Page Templates
    11. Advanced Zope Scripting
    12. Searching and Categorizing Content
    13. Relational Database Connectivity
    14. Scalability and ZEO
    15. Extending Zope
    16. Appendix A: DTML Reference
    17. Appendix B: API Reference
    18. Appendix C: Zope Page Templates Reference
    19. Appendix D: Zope Resources

  •  

    Zope runs on Linux, Unix, Windows, and MacOS X. Zope comes with everything you need to get up and running including a built-in web server and search engine.

    Exercise 0: Get Zope (2.5.1)

    Start by downloading the appropriate version for your platform, and follow the installation instructions referenced on the download page. Use a username and password that you can remember. Also, the default port of 8080 should be fine. Install zope in an appropriately named directory that you will remember is a test installation for learning purposes.

    Double-check that you can access http://localhost:8080 on your development machine. You should now be at Zope Quick Start. Also double-check that you can log in to the Zope Management Interface (ZMI) using the link on the start page. If all went well, then you are now running Zope. Congratulations.

    Exercise 1: Static Content

    Read the Using Zope and the Using Basic Zope Objects chapters of the Zope Book. You might find the PDF version of the book to be the most easily navigable.

    Log into the ZMI, and create a folder using the "Select type to add..." pull-down menu and subsequent form. Give it an id of ps1, and a title of "Problem Set 1". Leave the checkmarks unchecked. This is where you will store your solutions for this problem set. Click on the newly created folder. You should see that "There are currently no items in Problem Set 1". You have created a folder object using the ZMI.

    Now create a DTML Document with id solutions and title "Problem Set 1 Solutions", using the "Add and Edit" submit button. In the text area, remove the text "This is the <dtml-var id> Document", and replace it with the string "Hello World from Zope". Now visit http://localhost:8080/ps1/solutions . You have created your first Zope page. You can record your answers to any rhetorical questions in this solutions page.

    1. Why does Zope return the same thing when you hit http://localhost:8080/ps1 and at http://localhost:8080/ ?

      Alter the object representing your solutions page so that the url of your solutions is http://localhost:8080/ps1/ instead of http://localhost:8080/ps1/solutions.

    2. Change the footer of your solutions page to include the image at http://www.3gwt.net/images/footer.gif instead of the default Zope logo. Don't merely link to the image. Create an image object in your ps1 folder. (Hint: create a new dtml method named standard_html_footer that refers to this image in your ps1 folder. This will override the default.) You did read Using Zope Images in Chapter 3 of the Zope Book, right?

    Exercise 2: Installing Zope Products

    Suppose you have a directory of images, and you would like to view them as an image gallery that automatically stays up to date.

    • Install PIL into Zope's instance of Python.

    • Install ZipFolder into Zope.

    • Upload a zipfile full of images.

    • Create a Page Template that uses the ZTUtils.Batch class from the Zope API to display a certain number of images per page.


    Structured Text - Introduction

    Structured text uses indentation and simple symbology to indicate the structure of a document.

    Elements of a Structured Text

    A simple sample Table

    emphasized

    strong

    underlined

    Link to ZOPE

    Text enclosed in brackets [footnote] is treated as hyperlinks within the document.

    Three types of lists

    1. Ordered lists with digits

    Description
    A paragraph with a first line that contains some text, followed by some white-space and -- is treated as a descriptive list element.

    Example code

    Sub-paragraphs of a paragraph that ends in :: is treated as example code:

        <html>...</html>
    

    [footnote] Here is the footnoote.