Download What Is Zope?
Transcript
i4857-3 Ch14.F 3/1/02 9:41 AM Page 397 Chapter 14 ✦ Core Zope Components ZODB and Persistence If you’ve done a bit of programming in Python or another object-oriented language and you’re like us, you’re probably addicted to creating object hierarchies to model your problems. This is natural — humans think in outlines. We categorize information this way. For instance, think of how scientists categorize living creatures into kingdom, phylum, class, order, suborder, family, genus, and species. The top-level categories (known as kingdoms) include Animalia, Plantae, Fungi, Protista, and Prokaryotae. Within a given kingdom you have subcategories (called phylum or divisions). For example, some of the living creatures in the Animalia kingdom can be further categorized depending on whether they have spines. Objects are great for modeling this kind of information. But if you’ve programmed with objects for a while, you are probably familiar with the pains that are associated with trying to make this kind of information permanent. You have a couple of choices. You could create your own file format and write all of this information out to disk, or you could try mapping this information to a SQL (Structured Query Language) database. Both options could quickly become the brunt of your programming chore while writing and marinating your application. Luckily, Python provides a simple module called Pickle that takes care of converting objects to a format that can easily be stored on disk or moved around on a network and then converted back to objects again. This process is known as marshaling. The creators of Zope couldn’t leave well enough alone and combined the Pickle module into a package called ZODB (Zope Object Database), which provides a rich set of features such as Transactions, Undo support, and caching. If you’ve read through Part II and created the application we outlined, you’re already familiar with how little effort is needed on your part to use the ZODB. Most of the work is completely transparent to the developer, which is good because it frees you to worry more about the problem you are trying to solve instead of worrying about manipulating bits on a hard disk. CrossReference The ZODB can’t be compared directly to a SQL database because it’s missing one important piece of functionality. It does not include any searching capabilities. The ZODB was designed specifically to store and retrieve objects and to make this process as transparent as possible for the developer. Searching the ZODB, however, is left entirely up to your application. One method that can be used to accomplish this is to start at the top of the hierarchy and search each object and its attributes. Besides being tedious, this process can be time and resource intensive when searching a large database. Luckily there’s an alternative called ZCatalog that provides indexing and searching capabilities. To find out more about the ZCatalog see Chapter 17. In the next couple of sections in this chapter we give you some in depth examples showing you the intricacies of the ZODB and how you can use it in applications that you create outside of Zope. 397
Related documents
Notebook PC User Manual
Oracle WebServer User's Guide
NetRexx User's Guide
The Definitive Guide to Plone
Honeywell Thermostat C User's Manual
TSR User Manual - Parent Directory
IxP4000 Installation Manual
Getting Started with matchIT
GroupServer Documentation
A guide to Fle3
OpenRC System WebGUI – User Manual Software Version - X-Net