Articles / The Book of Zope

The Book of Zope

Zope is perhaps the best known of the Python Web publishing frameworks. It includes its own Web server (though you can run it behind Apache or IIS, for example), FTP server, and ACID-compliant object database. There is more to it than that, but that's Zope in a nutshell.

A year ago, there weren't any English language Zope books to be had. Now, there is a small collection -- five that I know of, with a sixth due next week. The first two Zope books appeared in Europe before any of the English texts, one in France, the second in Germany. (There was some debate about which was really first, but, like twin babies, it doesn't matter.) The Book of Zope is a translation of the German text, but you wouldn't know it unless you read the fine print. Jody Byrne, the translator, has done a first-rate job.

The Book of Zope is an introductory book, competing with The Zope Book. (I've not seen the Zope Bible, so I can't place its technical level.) The authors say it can be used by both beginning and advanced Zope users. I'd disagree. To me, it is most useful to people who want to learn what Zope is and how to become moderately competent with it. There are a lot of questions you would want answered if you were to run Zope on the Internet, and the book doesn't touch any of them. (For example, by default, Zope's built-in Web server runs on port 8080 and the FTP server on port 8021. What's involved in running them on ports 80 and 21? How do you set up proper file permissions? CVS? How do you deal with log files? Performance testing?) You're given a brief guide to installing Zope on Windows and Linux (although the installation instructions won't work with the current version of Zope because of a tar bug). It's enough to learn to program Zope but not to try to build freshmeat part deux.

Still, these are minor quibbles. The first three chapters will help you get Zope installed, create a few Web pages that show off the power of Zope, make your way through the management screens, and learn some of the basics of maintaining a Zope server, how to back up your database (ZODB -- the Zope Object Database) file, how to copy the database to another server, etc. Unfortunately, the authors don't point out that you can build your Zope site on a Windows box and copy the database to a Linux server without having to run special import/export or conversion routines.

Chapter 4 will help you understand DTML (the Dynamic Template Markup Language), a simple but powerful language for controlling output from the database to HTML. (It's similar to PHP; you program in it, but the Web browser never sees it.) DTML is losing favor now to Python scripts and ZPT (Zope Page Templates, which make Zope, Dreamweaver, and GoLive friendly). The chapter does a decent job of helping you learn DTML and become comfortable with it. The authors include some handy tables that help you quite a bit -- formatting conventions for dates, upper- and lower-casing text, basic math, date math, etc. The examples are simple; I would have preferred that they at least went into one or two more complex realworld examples, such as creating batch screens with next and previous links, like an image gallery. They tell you it's quite easy to do some very powerful things to extend the code, and that is true, provided you know your way around DTML, but when you first learn Zope, it's not always obvious how to get to the next level.

Chapters 5 through 8 cover versions, users, roles, security, permissions, and authentication. They're all good introductions to their respective subjects, and I didn't have any real quibbles with what they covered. Again, this is an introductory book.

Chapter 9 covers ZClasses, which allow you to create basic reusable components, such as a document that has extra properties, will automagically display new properties added to the base document, and will automagically update the search engine when it's created or changed. It's a pretty good chapter, with lots of example code that keep extending the sample product (a book database, something that really helps you learn Zope). One of the nice things about Zope is that you can edit documents with an FTP-aware editor like Emacs, but the documents you create in this chapter can't be edited with Emacs. If you're just working through the chapter to understand the example, that isn't a major issue, but if you're trying to build something you want by roughly following the example and have an Emacs itch, you'll get stuck. That criticism aside, I rather liked this chapter for the detail of the example.

The chapter on ZCatalog, the built-in search engine, gives a good introduction to understanding how powerful ZCatalog is. There are lots of little examples, and again, I wish they were more complex and closer to the real world. For example, if you want to display on one page the contents of each document returned from a query, you won't know how to do that after reading this chapter. You really shouldn't be doing that (because of memory issues), but it would be nice to be shown how to it with an explanation of why you shouldn't. :)

If you would prefer to store your data not in the ZODB but in MySQL, Chapter 12 is for you. Zope can be used with PostgreSQL, MySQL, Oracle, SQL Server, InterBase, and probably a few more SQL databases. Chapter 12 discusses just MySQL, which is good enough to understand how it works and just how powerful Zope's SQL support is.

Chapter 13 introduces you to Zope's Python support. Until this point in the book, you've been using DTML, but you can use Python to do everything that you can do in DTML. For some simple things, DTML is less work, but anything more complex than presentation code is best done with Python. Chapters 14 and 15 go into progressively greater detail about Zope's Python support.

Debugging is introduced in Chapter 16. Chapter 17 has a light introduction to working with external programs (e.g., FTP clients, WebDAV, XML-RPC, and Radio Userland). I would have liked to have seen some Emacs, BBEdit, and HTML-Kit discussions here. Appendix A has a nicely detailed DTML reference.

I really liked the book. The only criticism I have is that some of the tricker bits of Zope (DTML and the ZCatalog) could have used more complex examples. Zope has a sufficiently steep learning curve that examples are, in my opinion, very important. You can't take the book, go off to your cabin, and come back a Zope guru, but you'll be well on your way. There are a few editing mistakes (an incorrect screenshot, a wrong chapter reference, etc.), but no minor or consistently annoying errors of the type you find in Wrox books, for example. The few errors aren't noted on the errata page at No Starch, which is empty.

If you're new to Zope and are trying to decide between The Zope Book and The Book of Zope, I would recommend The Book of Zope. If you're an experienced Web programmer, you might prefer the more terse approach in The Zope Book. The Book of Zope has more examples and lots of useful charts that are a huge help to a newbie. For a technical book, the layout is quite nice, one of the nicest I've seen. After you've read The Book of Zope, the next book for you to read would be Zope: Web Application Development and Content Management, an intermediate-level book. The ultimate Zope introductory book has yet to be written, but The Book of Zope is a pretty good first attempt, and is highly recommended.


Project Spotlight

Kigo Video Converter Ultimate for Mac

A tool for converting and editing videos.


Project Spotlight


An efficient tagger for MP3, Ogg/Vorbis, and FLAC files.