Tải bản đầy đủ (.pdf) (649 trang)

John wiley sons zope bible

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (4.4 MB, 649 trang )

4857-3 cover

2/20/02

12:48 PM

Page 1

If Zope can do it, you can do it too . . .
Power, versatility, and broad community support have made Zope one of the fastest-growing Open Source
platforms around. This in-depth guide brings you up to speed fast on Zope’s innovative Web site and
application development model. Two veteran Zope developers cover all aspects of Zope in detail, from
installation to advanced topics like debugging, persistence, and automatic indexing support. Whether you’re a
Web developer, a Web architect, or a content manager, you’ll learn all you need to know to put Zope to work.

Inside, you’ll find complete
coverage of Zope

100%
C O M P R E H E N S I V E

100%
ONE HUNDRED PERCENT

COMPREHENSIVE
AUTHORITATIVE
WHAT YOU NEED
ONE HUNDRED PERCENT

• Develop a complete multi-user application as
a Python Product


• Master content management and version
control strategies
• Manage databases using SQL and DTML tags
• Use Zope’s built-in security to safeguard Web
sites and applications



Zope enables
you to give an
entity a role on
a particular
object. This is
called a Local role.

Zope

Most of the
true work
in Zope is
done via the
management
interface.

• Learn Zope Product development using
Python Products and ZClasses

of the leading
Open Source Web
application server


Master Zope’s
innovative Web
object development
model

Build secure,
flexible, and
powerful Web sites
and Web applications

• Find out how to run Zope behind Apache using
PCGI, FCGI, or Proxy Pass
You can
install the Zope
Packages
on Linux using
GnoRPM’s
point and click
interface.

Bonus CD-ROM
• Zope
• Adobe GoLive tryout version
• Dreamweaver trial version from Macromedia
• Plus sample applications and code from the book

www.hungryminds.com
Pentium PC, 128 MB RAM. See the
About the CD Appendix for details

and complete system requirements.

$49.99 USA
$74.99 Canada
£39.99 UK incl. VAT

Reader Level:

Shelving Category:

Beginning to Advanced

Web Development

ISBN 0-7645-4857-3

*85 5 -AJEFBc

— Paul Everitt, Co-founder and Vice President of Products,
Zope Corporation

Unleash the power

• Set up and run Zope on Linux or Windows

System Requirements:

“The Zope Bible is an indispensable, hands-on guide
to Zope product development.”


,!7IA7G4-feifhe!:p;o;t;T;T

ope
Z



BERNSTEIN &
ROBERTSON

Bible
Zope
and more
on CD-ROM

BONUS
CD-ROM
Zope plus sample
code from the book

Michael R. Bernstein, Scott Robertson,
and the Codeit Development Team


a4857-3 FM.F

3/1/02

9:36 AM


Page i

Zope Bible



a4857-3 FM.F

3/1/02

9:36 AM

Page ii


a4857-3 FM.F

3/1/02

9:36 AM

Page iii

Zope Bible


Michael R. Bernstein, Scott Robertson,
and the Codeit Development Team

Best-Selling Books • Digital Downloads • e-Books • Answer Networks • e-Newsletters • Branded Web Sites • e-Learning

New York, NY ✦ Cleveland, OH ✦ Indianapolis, IN


a4857-3 FM.F

3/1/02

9:36 AM

Page iv

Zope™ Bible
Published by
Hungry Minds, Inc.
909 Third Avenue
New York, NY 10022
www.hungryminds.com

Copyright © 2002 Hungry Minds, Inc. All rights reserved. No part of this book, including interior design, cover design, and
icons, may be reproduced or transmitted in any form, by any means (electronic, photocopying, recording, or otherwise)
without the prior written permission of the publisher.
Library of Congress Control Number: 2001118285
ISBN: 0-7645-4857-3
Printed in the United States of America
10 9 8 7 6 5 4 3 2 1
1B/SQ/QT/QS/IN
Distributed in the United States by Hungry Minds, Inc.
Distributed by CDG Books Canada Inc. for Canada; by Transworld Publishers Limited in the United Kingdom; by IDG Norge
Books for Norway; by IDG Sweden Books for Sweden; by IDG Books Australia Publishing Corporation Pty. Ltd. for Australia
and New Zealand; by TransQuest Publishers Pte Ltd. for Singapore, Malaysia, Thailand, Indonesia, and Hong Kong; by

Gotop Information Inc. for Taiwan; by ICG Muse, Inc. for Japan; by Intersoft for South Africa; by Eyrolles for France; by
International Thomson Publishing for Germany, Austria, and Switzerland; by Distribuidora Cuspide for Argentina; by LR
International for Brazil; by Galileo Libros for Chile; by Ediciones ZETA S.C.R. Ltda. for Peru; by WS Computer Publishing
Corporation, Inc., for the Philippines; by Contemporanea de Ediciones for Venezuela; by Express Computer Distributors for
the Caribbean and West Indies; by Micronesia Media Distributor, Inc. for Micronesia; by Chips Computadoras S.A. de C.V.
for Mexico; by Editorial Norma de Panama S.A. for Panama; by American Bookshops for Finland.
For general information on Hungry Minds’ products and services please contact our Customer Care department within the
U.S. at 800-762-2974, outside the U.S. at 317-572-3993 or fax 317-572-4002.
For sales inquiries and reseller information, including discounts, premium and bulk quantity sales, and foreign-language
translations, please contact our Customer Care department at 800-434-3422, fax 317-572-4002 or write to Hungry Minds,
Inc., Attn: Customer Care Department, 10475 Crosspoint Boulevard, Indianapolis, IN 46256.
For information on licensing foreign or domestic rights, please contact our Sub-Rights Customer Care department at
212-884-5000.
For information on using Hungry Minds’ products and services in the classroom or for ordering examination copies, please
contact our Educational Sales department at 800-434-2086 or fax 317-572-4005.
For press review copies, author interviews, or other publicity information, please contact our Public Relations department
at 317-572-3168 or fax 317-572-4168.
For authorization to photocopy items for corporate, personal, or educational use, please contact Copyright Clearance
Center, 222 Rosewood Drive, Danvers, MA 01923, or fax 978-750-4470.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND AUTHOR HAVE USED THEIR BEST EFFORTS
IN PREPARING THIS BOOK. THE PUBLISHER AND AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH
RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS BOOK AND SPECIFICALLY DISCLAIM
ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. THERE ARE NO
WARRANTIES WHICH EXTEND BEYOND THE DESCRIPTIONS CONTAINED IN THIS PARAGRAPH. NO WARRANTY
MAY BE CREATED OR EXTENDED BY SALES REPRESENTATIVES OR WRITTEN SALES MATERIALS. THE ACCURACY
AND COMPLETENESS OF THE INFORMATION PROVIDED HEREIN AND THE OPINIONS STATED HEREIN ARE NOT
GUARANTEED OR WARRANTED TO PRODUCE ANY PARTICULAR RESULTS, AND THE ADVICE AND STRATEGIES
CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY INDIVIDUAL. NEITHER THE PUBLISHER NOR AUTHOR
SHALL BE LIABLE FOR ANY LOSS OF PROFIT OR ANY OTHER COMMERCIAL DAMAGES, INCLUDING BUT NOT
LIMITED TO SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR OTHER DAMAGES. FULFILLMENT OF EACH COUPON

OFFER IS THE SOLE RESPONSIBILITY OF THE OFFEROR.
Trademarks: Hungry Minds and the Hungry Minds logo are trademarks or registered trademarks of Hungry Minds, Inc. in
the United States and other countries and may not be used without written permission. Macromedia and Dreamweaver are
trademarks or registered trademarks of Macromedia, Inc. in the United States and/or other countries. Copyright ©
1997–2000. Macromedia, Inc. 600 Townsend Street, San Francisco, CA 94103 USA. All Rights Reserved. Zope is a trademark
or registered trademark of Zope Corporation. All other trademarks are the property of their respective owners. Hungry
Minds, Inc., is not associated with any product or vendor mentioned in this book.

is a trademark of Hungry Minds, Inc.


a4857-3 FM.F

3/1/02

9:36 AM

Page v

About the Authors
Michael Bernstein is an information architect for Codeit. He has been a member of
the Zope development community since it was released as Open Source in late
1998, and wrote the first community-contributed “How-To” for Zope in February of
1999. Michael was one of the technical reviewers for The Zope Book published by
New Riders in 2001, and created the Zope category in the Open Directory Project
(dmoz.org). Currently residing in Las Vegas, he has worked for two start-ups before
joining Codeit and has built and managed various Content Management Systems
and intranets using Zope. His interests include Science Fiction Fandom, Open
Source, and other self-organizing emergent phenomena. His personal Web site is at
.


Scott Robertson co-founded Codeit in 1997, a company dedicated to building custom applications that help businesses increase productivity and lower expenses. In
1998, he discovered a technology named Bobo that was so compelling that he
learned Python and swore off Perl forever. When Principia (an application built on
Bobo) was renamed Zope and released as Open Source, he selected it as Codeit’s
preferred Web platform. An ardent believer in Open Source, he has contributed several products to the community and encourages his employees to do the same.
When he’s not working he can usually be found creating strategies for achieving
world domination, or at the very least devising ones that will annoy his partners.

The Codeit Development Team has over 15 years of combined Zope experience.
Besides the primary authors, other Codeit developers and staff contributed material to this book, including Nick Garcia, Erik Burrows, Forest Zachman, Brent Rogan,
and Sam Stimson.
The entire Codeit team is dedicated to using Open Source technologies on behalf of
our customers, so that at the conclusion of a project they have the skills, code, and
documentation on how to change and scale each application we build, enabling
them to be as self-reliant as they wish to be. Beyond development, Codeit also
offers Zope hosting as one of its services.


a4857-3 FM.F

3/1/02

9:36 AM

Page vi

Credits
Acquisitions Editor
Terri Varveris

Project Editor
Barbra Guerra
Technical Editor
Tom Deprez
Copy Editors
Katherine Dvorak
Ryan Rader
Permissions Editor
Carmen Krikorian
Editorial Manager
Kyle Looper
Project Coordinator
Ryan Steffen

Graphics and Production Specialists
Sean Decker
Joyce Haughey
Gabriele McCann
Heather Pope
Betty Schulte
Quality Control Technicians
Laura Albert
John Greenough
Andy Hollandbeck
Carl Pierce
Linda Quigley
Charles Spencer
Media Development Specialist
Travis Silvers
Proofreading and Indexing

TECHBOOKS Production Services
Cover Illustration
Kate Shaw


a4857-3 FM.F

3/1/02

9:36 AM

Page vii

To Ruth, for doing such a good job raising me; to Roxanne, for making my life
complete; and to Talia, for the future.
— Michael

To Kyle Reid, welcome to the party. Glad you could make it.
— Scott


a4857-3 FM.F

3/1/02

9:36 AM

Page viii



a4857-3 FM.F

3/1/02

9:36 AM

Page ix

Preface

H

i! You’re holding the Zope Bible, a book we suspect will change how you look
at building Web sites and Web applications. If you’re like most Web developers and designers, you’re probably always looking for ways to improve your process, both for building and for maintaining Web sites. Whether the sites you’re
building are consumer-oriented Web applications, content-centric publishing sites,
intranets, or even vanity sites, you want to build them faster, maintain them easier,
and integrate other people into your workflow with a minimum of hassle and fuss.
Zope is a tool that is hard to describe, as in many ways it’s in a category all its own.
So, rather than describe what it is, it’s better to describe what Zope can do for you:
✦ Zope contains a templating language for creating dynamic pages, making it
easier to create and maintain a common look and feel for your site.
✦ Zope uses a powerful scripting language (Python) for creating business logic,
making it easy to create powerful Web applications.
✦ Zope has a built-in Web management interface so you can create and maintain
entire sites with nothing more than a standard browser and an Internet
connection.
✦ Zope has a built-in object database, making it easy to store content, logic, and
presentation in a single place.
✦ Zope has a built-in security framework, making it easy and safe to delegate
maintenance of sections or subsections of the site to other people.

✦ Zope sites are also accessible via FTP and WebDAV, making it easier to leverage the desktop site creation tools you already use.
✦ Zope is written in Python, making it easy to extend and enhance with your
own customizations.
✦ Zope has built-in content management tools such as Version objects and
Undo, which make it easier to safely modify and update a site while it’s “live.”

In other words, if you build Web sites, Zope is the tool for you.


a4857-3 FM.F

x

3/1/02

9:36 AM

Page x

Zope Bible

Why We Wrote This Book
In the two years since Zope was open-sourced, the user and developer communities
have grown tremendously. However, while Zope itself has grown and become both
more powerful and easier to use, the documentation has not kept pace.
The most glaring omission, the lack of a user manual, was remedied last year with
the release of The Zope Book by Amos Latteier and Michel Pelletier (New Riders,
2001). This was a very important milestone, as The Zope Book was a complete reference for using Zope to build Web sites and simple applications. However, by focusing on thoroughly covering the basics, it left those who wanted to take advantage of
Zope’s more advanced features out in the cold.
At Codeit Computing, we’ve long wanted a book that could serve as a textbook for

educating our own employees, not only teaching them the basics, but more
advanced topics as well, such as extending Zope with Python products and building
advanced user interfaces. We’ve also wanted a book that we could hand to our
clients and their IT staff to make it easier for them to assume the maintenance of
the projects that we complete.
When we were approached to write this book, we determined that this would be
our opportunity to write the book that we wished we had all along.

What You Need
To follow along with the steps in this book you need to know how to use your
browser. Don’t laugh! Zope is very browser-centric. Knowing what the “Back” button does, or that right-clicking a link lets you launch the link target in another window is kind of important when you’re actually using your browser to develop a Web
site.
This book assumes that you already know how to build Web sites “the old fashioned way.” A basic familiarity and ability to write HTML, including tables and
forms and using a text editor, will be very handy. In fact, we assume that you’re sick
and tired of maintaining your sites by hand.
A familiarity with some other application server or middleware technology is helpful, but not really required. Examples of these are Macromedia ColdFusion,
Microsoft Active Server Pages, Java Servlets, Java Server Pages, or PHP.
Regardless of your operating system, you’ll need to have the appropriate privileges
to install software on your computer. Zope is very lightweight, and can be installed
on most desktops with a minimum of fuss, but many corporate environments don’t
give users the ability to install software.


a4857-3 FM.F

3/1/02

9:36 AM

Page xi


Preface

DTML, Python, and ZPT Code Conventions
This book contains many small snippets of code, as well as complete code listings.
Each listing appears in a monospace font.
If a line of code doesn’t fit on a single line in this book, We use the arrow (Æ)
symbol. For example, the following two lines comprise a single line of code:
start=start sort_expr=”sort_by”>

What the Icons Mean
Throughout the book, we’ve used icons in the left margin to call your attention to
points that are particularly important.
Note

We use Note icons to tell you that something is important — perhaps a concept
that may help you master the task at hand or something fundamental for understanding subsequent material.

Tip

Tip icons indicate a more efficient way of doing something, or a technique that
may not be obvious.

On the
CD-ROM

Caution

These icons indicate that an example file is on the companion CD-ROM.


We use Caution icons when the operation that we are describing can cause problems if you’re not careful.

New
Feature

We use this icon to indicate that the material discussed is new to the latest Zope
version.

CrossReference

We use the Cross-Reference icon to refer you to other chapters that have more to
say on a subject.

xi


a4857-3 FM.F

xii

3/1/02

9:36 AM

Page xii

Zope Bible

How This Book Is Organized

This book is organized into four parts that are meant to be read in order if you’re a
complete newcomer to Zope.

Part I: Getting Started with Zope
In this section Zope is introduced, as are the fundamentals of coding in DTML and
Python. If you are already an experienced Zope user, and want to jump to Part II and
start developing Python Zope Products, we suggest reading Chapter 5, “ObjectOriented Programming and Python,” in this section first, even if you’re already
familiar with Python.

Part II: Building Zope Products
In this section, we build upon the material from Part I, and show you how to extend
Zope with new object types. At the end of this section, you will have built a powerful and useful Web application.

Part III: Zope Management
Zope provides powerful tools for building and maintaining Web sites. In this section, several aspects of Zope are explored in-depth. Chapter 11 covers content
management strategies using Zope, Chapter 12 explains data management
including integrating external RDBMSs, and Chapter 13 deals with security and
user management.

Part IV: Advanced Zope Concepts
In this section, we’ve put the advanced topics that are relatively independent of
each other and the rest of the book. Chapter 14 describes in detail the various parts
and pieces that Zope is built out of and how they fit together; Chapter 15 covers
writing scripts for Zope using Python and/or Perl Script Objects; Chapter 16 covers
ZClasses for those who wish to develop products entirely within the browser;
Chapter 17 explains Zope’s Searching and indexing framework, and how to create
automatically indexed content objects; Chapter 18 introduces Zope Page
Templates, a new presentation scripting technology introduced in Zope 2.5; Chapter
19 covers Debugging; and Chapter 20 addresses creating and running clusters of
Zope servers.


Appendixes
Appendix A describes the material included on the CD-ROM, and Appendix B covers installing Zope from source code or RPM files.


a4857-3 FM.F

3/1/02

9:36 AM

Page xiii

Preface

Web Site
We, the authors of the Zope Bible, have set up a Web site specifically for the readers
of this book at . The Web site contains additional information, sample code from the book, links to Zope-related Web sites, and other
items and information we think you’ll find useful.

xiii


a4857-3 FM.F

3/1/02

9:36 AM

Page xiv



a4857-3 FM.F

3/1/02

9:36 AM

Page xv

Acknowledgments

T

his book represents a great deal of very hard work (if only we had known what
we were getting into), and the authors couldn’t have succeeded without the
following list of extremely pushy people who insisted they get some credit:
The other employees at Codeit Computing, who pitched in to help with individual
chapters when we realized we needed their expertise, particularly: Erik Burrows,
who wrote a phenomenal chapter on RDBMS integration (Chapter 12); Nick Garcia,
who has debugged enough of our code that he was able to write a chapter on how
to debug yours (Chapter 19); and Forest Zachman, Zope scripting dude number one
(Chapter 15).
The incredible Zope Development Community, including the following folks from
the #zope IRC channel who helped answer both newbie and advanced questions:
Kapil Thangavelu (hazmat); Ron Bickers (rbickers); George A. Runyan Jr. (runyaga);
Andrew Milton (TheJester); Chris McDonough (chrism); Andreas Jung (YET);
R. David Murray (rdmurray); Alex Verstraeten (zxc); M. Adam Kendall (DaJoker);
and Morten W. Petersen (Morphex). A special thanks goes to Chris Withers for
pitching in on the final review at the last minute. Far too many others in the Zope

community, on the mailing lists and in the IRC channel, helped with suggestions,
code snippets, HowTos, tutorials, and detailed explanations on every aspect of
Zope over the years than could be listed here. We couldn’t have learned as much as
we did without the rest of you. The community is a big part of what makes Zope a
success.
Any remaining bugs in the book’s example code are definitely their fault.
Many thanks go to the great folks at Hungry Minds: Terri Varveris, our acquisitions
editor, for understanding that we have day jobs and whose efforts went above and
beyond the call of duty; Barb Guerra, our project editor, whose gentle guidance
forced us into submitting our chapters; Tom Deprez, our technical editor, for helping to make the book both clearer and more complete; and Katharine Dvorak and
Ryan Rader, our copy editors, who fixed punctuation gaffes, rephrased subjunctive
sentences, and cut out unnecessary prepositions with reckless abandon.
And of course, all the great folks at Zope Corporation, for creating an open-source
Web application platform that lets us solve our customer’s problems without creating new ones.


a4857-3 FM.F

xvi

3/1/02

9:36 AM

Page xvi

Zope Bible

Michael adds:
Besides the folks mentioned above, I’d also like to extend my personal thanks to the

following people:
My co-author Scott Robertson and Codeit CEO Jason Reid deserve my thanks for
giving me the opportunity to write this book and accepting my tendency to
perfectionism.
Roxanne, for encouraging me when I was down, and keeping my eye on the ball
when things just seemed too hard, even though she really deserved my attention
more.
The members of the Southern Nevada Area Fantasy and Fiction Union (snaffu.org),
who deserve my thanks for not complaining even though they didn’t really get the
club Vice President they voted for (no, guys, I am not taking you all to Disneyland).
Scott adds:
Thanks to my partners, Chris Klein and Jason Reid, who told me to not write a book
because I didn’t have time and I’d hate the process (they know me too well) and
then helped out in every possible way when I ran into trouble because I never
listen.


a4857-3 FM.F

3/1/02

9:36 AM

Page xvii

Contents at a Glance
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv

Part I: Getting Started with Zope . . . . . . . . . . . . . . . . . . . . . . 1

Chapter 1: Overview of Zope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Chapter 2: Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Chapter 3: Zope Objects and the Management Interface . . . . . . . . . . . . . . 31
Chapter 4: Document Template Markup Language . . . . . . . . . . . . . . . . . . 65
Chapter 5: Object-Oriented Programming and Python . . . . . . . . . . . . . . . 121

Part II: Building Zope Products . . . . . . . . . . . . . . . . . . . . . . 175
Chapter 6: From Packages to Products . . . . . .
Chapter 7: Creating an AddressBook Application
Chapter 8: Enhancing the AddressBook . . . . .
Chapter 9: Zope Product Security . . . . . . . . .
Chapter 10: Creating a Multi-User AddressBook .

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.


.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.


.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.


.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.


177
197
231
267
291

Part III: Zope Management . . . . . . . . . . . . . . . . . . . . . . . . 309
Chapter 11: Content Management Strategies . . . . . . . . . . . . . . . . . . . . 311
Chapter 12: Database Management . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Chapter 13: User Management and Security . . . . . . . . . . . . . . . . . . . . . 367

Part IV: Advanced Zope Concepts . . . . . . . . . . . . . . . . . . . . 387
Chapter 14: Core Zope Components . . . . . . . .
Chapter 15: Scripting Zope . . . . . . . . . . . . . .
Chapter 16: ZClasses . . . . . . . . . . . . . . . . .
Chapter 17: Searching Content . . . . . . . . . . . .
Chapter 18: Zope Page Templates . . . . . . . . . .
Chapter 19: Debugging . . . . . . . . . . . . . . . .
Chapter 20: Alternative Methods of Running Zope

.
.
.
.
.
.
.

.

.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.


.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.

.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.

.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.

.
.
.
.
.
.

389
439
455
491
517
541
557

Appendix A: What’s on the CD-ROM . . . . . . . . . . . . . . . . . . . . . . . . . 567
Appendix B: Installing Zope from the Red Hat RPMs or Source Code . . . . . . . 571
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579
End-User License Agreement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616


a4857-3 FM.F

3/1/02

9:36 AM

Page xviii



a4857-3 FM.F

3/1/02

9:36 AM

Page xix

Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv

Part I: Getting Started with Zope

1

Chapter 1: Overview of Zope . . . . . . . . . . . . . . . . . . . . . . . . . 3
What Is Zope? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
History of Zope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Features of Zope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Database adapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Web-based user interface . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Integration with existing tools . . . . . . . . . . . . . . . . . . . . . . . . 6
Open source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Extendibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Built-in Web server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Plays nice with third-party Web servers . . . . . . . . . . . . . . . . . . 7
Multiple protocol support . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Indexing and searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Built-in object database . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Built-in security model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Clustering and load balancing . . . . . . . . . . . . . . . . . . . . . . . . 7
Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Undo support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Zope Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
ZServer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
ZPublisher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Transaction Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
ZODB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
ZEO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
ZRDBM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Zope Advantages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Low cost of ownership . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Fast development/deployment time . . . . . . . . . . . . . . . . . . . 11
Reliability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Scalability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12


a4857-3 FM.F

xx

3/1/02

9:36 AM

Page xx


Zope Bible

Chapter 2: Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
What You Need to Run Zope . . . . . . . . . . . . .
Where to Find Zope . . . . . . . . . . . . . . . . . .
Installing Zope Under Windows . . . . . . . . . . .
Installing Zope Under Linux . . . . . . . . . . . . . .
Finding Your Way around Zope’s
Directory Tree . . . . . . . . . . . . . . . . . . . .
Starting up Zope for the First Time . . . . . . . . .
Logging in . . . . . . . . . . . . . . . . . . . . .
Shutting down . . . . . . . . . . . . . . . . . .
Copying your Web site to a different machine
Running Zope with ZServer . . . . . . . . . . . . . .
Modifying ZServer’s behavior with switches .
Using the command line switches
when running Zope as a service . . . . . .
Expanding Zope with Products . . . . . . . . . . . .
Installing new products . . . . . . . . . . . . .
Product troubleshooting . . . . . . . . . . . .
Getting Support . . . . . . . . . . . . . . . . . . . . .

.
.
.
.

.
.
.

.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.

.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.

.

13
14
14
16

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.


.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.

.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.

.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

18

20
21
21
23
23
24

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.


.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.


.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.


28
29
29
30
30

Chapter 3: Zope Objects and the Management Interface . . . . . . . 31
Object Basics . . . . . . . . . . . . . . . . . . . . . .
The Zope Management Interface . . . . . . . . . . .
Using the top frame . . . . . . . . . . . . . . .
Exploring folders with the Navigator frame .
Manipulating objects in the Workspace frame
Common Views . . . . . . . . . . . . . . . . . . . . .
Viewing objects through the Default view . .
Examining an object and its Properties . . .
Changing permissions in the Security view .
Simulating roles with the Proxy view . . . . .
Viewing ownership information . . . . . . . .
Fixing mistakes in the Undo view . . . . . . .
Folder Objects . . . . . . . . . . . . . . . . . . . . .
Adding folders . . . . . . . . . . . . . . . . . .
The contents View . . . . . . . . . . . . . . . .
Viewing a folder . . . . . . . . . . . . . . . . .
The Find view . . . . . . . . . . . . . . . . . .
DTML Documents . . . . . . . . . . . . . . . . . . .
Adding a DTML document . . . . . . . . . . .
Editing a DTML document . . . . . . . . . . .
Viewing a DTML Document . . . . . . . . . . .
Reviewing changes with the History view . .

DTML Methods . . . . . . . . . . . . . . . . . . . . .
Introducing the standard header . . . . . . . .
Overriding the standard header . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.


.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.

32
32
33
35
35
37
37
37
39
40
40
40
41
41
43
46
46
47
47
48
49
49

50
51
52


a4857-3 FM.F

3/1/02

9:36 AM

Page xxi

Contents

File Objects . . . . . . . . . . . . . .
Adding a file . . . . . . . . . .
Editing a file . . . . . . . . . .
Viewing a file . . . . . . . . . .
Image Objects . . . . . . . . . . . . .
Adding an image . . . . . . . .
Editing an image . . . . . . . .
Viewing an image . . . . . . .
User Folders and User Objects . . .
Adding a User Folder . . . . .
Editing a User Folder . . . . .
Adding a user . . . . . . . . .
Editing a user . . . . . . . . . .
Managing users . . . . . . . .
Control Panel . . . . . . . . . . . . .

Stopping and restarting Zope
Managing the database . . . .
Managing versions . . . . . . .
Managing products . . . . . .
Debug information . . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.


.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.


.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

52
52
52
54
54
54
54
55
55
56
56
56
57
57
58
59
60
62
62
64


Chapter 4: Document Template Markup Language . . . . . . . . . . . 65
DTML Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Where data comes from . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Understanding variables, properties, and methods . . . . . . . . . . . 67
DTML tag syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
The name attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
The expr attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
The dtml-var Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Entity syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Attributes of the dtml-var tag . . . . . . . . . . . . . . . . . . . . . . . 80
The dtml-if Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
The basics of conditional insertion . . . . . . . . . . . . . . . . . . . . 87
The dtml-else and dtml-elif tags . . . . . . . . . . . . . . . . . . . . . . 88
The dtml-unless Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
The dtml-in Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
The basics of iterative insertion . . . . . . . . . . . . . . . . . . . . . . 90
The dtml-else tag and empty sequences . . . . . . . . . . . . . . . . . 91
Attributes of the dtml-in tag . . . . . . . . . . . . . . . . . . . . . . . . 92
Current item variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Summary statistic variables . . . . . . . . . . . . . . . . . . . . . . . . 97
Grouping variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Batch processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
The dtml-with Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
The dtml-let Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

xxi


a4857-3 FM.F


xxii

3/1/02

9:37 AM

Page xxii

Zope Bible

The dtml-call Tag . . . . . . . . . . . . . . . .
The dtml-return Tag . . . . . . . . . . . . . .
The dtml-comment Tag . . . . . . . . . . . . .
The dtml-raise Tag . . . . . . . . . . . . . . .
The dtml-try Tag . . . . . . . . . . . . . . . .
Checking for errors . . . . . . . . . . .
Handling multiple exceptions . . . . . .
Optional dtml-else and dtml-finally tags
Writing your own error messages . . .
The dtml-tree Tag . . . . . . . . . . . . . . . .
Displaying objects in a tree . . . . . . .
Attributes of the dtml-tree tag . . . . .
Current item variables . . . . . . . . . .
Control variables . . . . . . . . . . . . .
The dtml-sendmail and dtml-mime Tags . . .
Creating dynamic e-mail messages . . .
Sending attachments . . . . . . . . . . .

.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

104
104
105
106
107
107
108
108
109
110
111
111
115
116
117
117
118

Chapter 5: Object-Oriented Programming and Python . . . . . . . . 121
Using the Interactive Interpreter . . . . . . . . . . . . . . .
Running Python Commands from a File . . . . . . . . . . .
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Types and Operators . . . . . . . . . . . . . . . . . . . . . .
Numbers . . . . . . . . . . . . . . . . . . . . . . . . . .
Sequences . . . . . . . . . . . . . . . . . . . . . . . . .

Dictionaries . . . . . . . . . . . . . . . . . . . . . . . .
Control Statements . . . . . . . . . . . . . . . . . . . . . . .
Conditional testing with the If statement . . . . . . .
Looping . . . . . . . . . . . . . . . . . . . . . . . . . .
Functions . . . . . . . . . . . . . . . . . . . . . . . . .
Understanding Namespaces . . . . . . . . . . . . . . . . . .
Namespaces within functions . . . . . . . . . . . . .
Creating and manipulating global variables . . . . .
Modules and Packages . . . . . . . . . . . . . . . . . . . . .
Using modules . . . . . . . . . . . . . . . . . . . . . .
Playing with the module path . . . . . . . . . . . . . .
Importing specific names from modules . . . . . . .
Creating and using packages . . . . . . . . . . . . . .
Examining the contents of a namespace with dir( ) .
Understanding .pyc files . . . . . . . . . . . . . . . . .
Classes and Objects . . . . . . . . . . . . . . . . . . . . . .
Defining a new class . . . . . . . . . . . . . . . . . . .
Class scope versus object scope . . . . . . . . . . . .
Methods . . . . . . . . . . . . . . . . . . . . . . . . . .
Controlling how classes are initialized with __init__
Inheritance . . . . . . . . . . . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.

122
124
126
128
128
133
144
146
148
151
154
159
160
161
161
162
163
163
164
166
166
166
167
167
168
169

169


a4857-3 FM.F

3/1/02

9:37 AM

Page xxiii

Contents

Exception Handling . . . . . .
Using the try statement
The except object . . .
Catching exceptions . .
Using else: with try . . .
The finally clause . . . .
Raising exceptions . . .
Where Do I Go From Here? . .

.
.
.
.
.
.
.
.


.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.

.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.

.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.


.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.

.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.

.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.


.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.

.
.
.
.
.
.

Part II: Building Zope Products

.
.
.
.
.
.
.
.

170
171
171
172
172
172
173
173

175

Chapter 6: From Packages to Products . . . . . . . . . . . . . . . . . 177

What’s a Product? . . . . . . . . . . . . . . . .
Creating a Hello World Package . . . . . . . .
Publishing Objects . . . . . . . . . . . . . . .
Changing a Package into a Product . . . . . .
Instantiating Your Object . . . . . . . . . . .
Filling out the manage_add methods .
Subclassing from Zope base classes . .
Adding DTML Methods . . . . . . . . . . . . .
Processing Form Submissions and Returning
Web-enabling the edit method . . . . .
Dealing with non-Web situations . . . .
Adding manage_editHelloForm . . . . .
Defining your own management tabs .

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.


.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.

.
.
.
.
.
.
.
.
.
.
.

178
179
180
181
184
184
186
188
191
191
193
193
194

Chapter 7: Creating an AddressBook Application . . . . . . . . . . . 197
The Addressit Product and the AddressBook Class . . . . .
Creating the Addressit Product . . . . . . . . . . . . . .
Creating edit and index_html Methods . . . . . . . . . . . .

Creating an Entry Module in the Addressit Product . . . . .
Adding, Listing, and Deleting Entries from the AddressBook
Adding entries to the AddressBook . . . . . . . . . . .
Testing the addEntryForm . . . . . . . . . . . . . . . .
Listing the entries in the AddressBook . . . . . . . . .
Traversing the AddressBook into the Entries . . . . . . . . .
You can’t get there from here . . . . . . . . . . . . . . .
Improving access to the entries . . . . . . . . . . . . .
Editing an Entry . . . . . . . . . . . . . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

197
198
201
205
215
215

220
222
226
226
227
227

xxiii


a4857-3 FM.F

xxiv

3/1/02

9:37 AM

Page xxiv

Zope Bible

Chapter 8: Enhancing the AddressBook . . . . . . . . . . . . . . . . . 231
Adding a Standard Header . . . . . . . . . . . . . .
Batching the Entries Display . . . . . . . . . . . .
Scaling to many results . . . . . . . . . . . .
About orphans . . . . . . . . . . . . . . . . .
Navigating among the batches . . . . . . . .
Grouping Entries . . . . . . . . . . . . . . . . . . .
Adding a GroupList attribute to

the AddressBook class . . . . . . . . . . .
Adding a Group attribute to the Entry class
Adding and Deleting Groups . . . . . . . . . . . . .
Retrieving Entries by Group . . . . . . . . . . . . .
Renaming Groups . . . . . . . . . . . . . . . . . . .
Sorting Entries by Column . . . . . . . . . . . . . .
Dealing with case-sensitivity . . . . . . . . .

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.

.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.

.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.

.

.
.
.
.
.
.

.
.
.
.
.
.

231
233
234
234
235
240

.
.
.
.
.
.
.


.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.

.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.

.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.

.
.
.
.
.
.

.
.
.
.
.
.
.

241
241
244
250
254
257
263

Chapter 9: Zope Product Security . . . . . . . . . . . . . . . . . . . . . 267
Security and the Web . . . . . . . . . . . .
Security 101 . . . . . . . . . . . . . .
The Web is fundamentally insecure
The Zope Security Framework . . . . . .
Roles . . . . . . . . . . . . . . . . . .
Acquisition . . . . . . . . . . . . . .

Ownership . . . . . . . . . . . . . . .
Local roles . . . . . . . . . . . . . . .
What Zope won’t do for you . . . .
What Zope will do for you . . . . . .
Determining your Security Requirements
The Default policy . . . . . . . . . .
Listing the methods . . . . . . . . .
Reusing existing roles . . . . . . . .
Reusing existing Permissions . . . .
Adding Security . . . . . . . . . . . . . . .
Adding Permissions . . . . . . . . .
Associating Permissions with roles

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.


.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

267
267
268
268
270
271
271
272
273
273
274
274
274
276
277
278

280
281

Chapter 10: Creating a Multi-User AddressBook . . . . . . . . . . . . 291
Creating the Addressit Class . . . . . . . . . . . . . . . . .
Adding AddressBooks . . . . . . . . . . . . . . . . . . . . .
Public and Private AddressBooks . . . . . . . . . . . . . .
Adding a Public attribute to the AddressBook class .
Using the Public attribute . . . . . . . . . . . . . . . .
Incorporating the user’s private AddressBooks . . .
Finishing Touches . . . . . . . . . . . . . . . . . . . . . . . .
Adding help . . . . . . . . . . . . . . . . . . . . . . . .
Adding an Icon . . . . . . . . . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.

.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.

.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.

.
.
.

.
.
.
.
.
.
.
.
.

292
297
301
301
302
303
306
306
307


Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×