Home > Store

Zope 3 Developer's Handbook

Register your product to gain access to bonus material or receive a coupon.

Zope 3 Developer's Handbook


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2005
  • Edition: 1st
  • Book
  • ISBN-10: 0-672-32617-5
  • ISBN-13: 978-0-672-32617-2

Be the first in line when the green flag for Zope 3 goes down with the help of the Zope Developer's Handbook. This collection of cookbook recipes provides easy-to-follow solutions to common problems you may face as a Zope or Python developer when beginning to implement the Zope 3 open-source application server. Utilize the book's solutions-oriented, task-based structure, as well as the supporting website for code used in each recipe, to help build your Zope components. Stay at the front of the line with the Zope Developer's Handbook.

Sample Content

Online Sample Chapters

Installing New Zope Packages

Installing New Zope Packages

Table of Contents


    Powerful Python 

    In the Beginning There Was… 

    Zope 3 Components 

    The Goals of This Book 


1. Installing Zope 3.

    Zope 3 Installation Requirements 

    Installing Zope from SVN 

    Installing the Source Distribution 

    Installing the Binary Distribution of Zope 

      sUnpacking the Package 

      Building Zope 

      Creating a Zope Instance 

      Running Zope 

    Installing the Source Distribution in Windows Without Using make 

2. The New Web-Based Zope User Interface.

    Getting Comfortable with the ZMI 

    Help and Documentation 

    The Scripter’s World 

    The Content Space Versus the Software Space 

      The Content Space 

      The Software Space 

3. Installing New Zope Packages.

    Step 1: Determining the Installation Directory 

    Step 2: Fetching the Wiki Application from SVN 

    Step 3: Registering the Package 

    Step 4: Confirming the Installation 

    Step 5: Adding a Sample Wiki Instance 

4. Setting Up Virtual Hosting.


5. The Zope 3 Development Process.

    From Idea to Implementation 

      Implementing New Components 

      Fixing Bugs 

    Zope 3 Naming Rules 

      Directory Hierarchy Conventions 

      Python Naming and Formatting Conventions 

      ZCML Naming and Formatting Conventions 

      Page Template Naming and Formatting Conventions 

      Test Writing Conventions 

      The Importance of Having and Following Conventions  

6. An Introduction to Interfaces.

    Advanced Usages of Interfaces 

    Using Interfaces 

7. The Component Architecture: An Introduction.




    Factories (Object Classes/Prototypes) 

    Presentation Components: Views, Resources, Skins, and Layers 

    Global Versus Local Components 

8. Zope Schemas and Forms.

    Schemas Versus Interfaces 

    The Core Schema Fields 

    Autogenerated Forms Using the forms Package 

      Text Widgets 

      Boolean Widgets 

      Single-Selection Widgets 

      Multiple-Selections Widgets 

      Miscellaneous Widgets 

      Using Widgets 

9. Introduction to the Zope Configuration Markup Language (ZCML).

    Using XML 

      The configure tag 

      The context Variable 

10. Introduction to Zope’s I18n and L10n Support.

    Diving into I18n and L10n 


    Messages and Message Catalogs 

    Internationalizing Message Strings 

      Python Code 




    Extracting Message Strings 

11. Metadata and the Dublin Core.

    The Dublin Core 

    The Dublin Core Elements 
















    Further Readings 

12. Porting Applications from Zope 2 to Zope 3.

    Porting an Application by Redesign 

    Porting Using Compatibility Layers and Scripts 


13. Writing New Content Objects.

    Step 1: Preparing to Write the Content Object 

    Step 2: Creating the Initial Design 

    Step 3: Writing the Interfaces 

    Step 4: Writing Unit Tests 

    Step 5: Implementing Content Components 

    Step 6: Running Unit Tests Against the Implementation 

    Step 7: Registering the Content Components 

    Step 8: Configuring Some Basic Views 

    Step 9: Registering the Message Board with Zope 

    Step 10: Testing the Content Component 

14. Adding Views for Content Objects.

    Step 1: Creating the Message Details View 

      Creating the Page Template 

      Creating the Python-Based View Class 

      Registering the View 

      Testing the View 

    Step 2: Specifying the Default View 

    Step 3: Adding the Threaded Subtree View 

      The Main Thread Page Template 

      The Thread Python View Class 

      The Subthread Page Template 

      Registering the Thread View 

      The Message Board Default View 

    Step 4: Adding Icons 

    Step 5: Final Testing 

15. Custom Schema Fields and Form Widgets.

    Step 1: Creating a Field 

      The Interface of the Field 

      Implementation of the Field 

      Unit Tests for the Field 

    Step 2: Creating a Widget 

      Implementation of the HTML Source Widget 

      Unit Tests for the Widget 

    Step 3: Using the HTML Field 

      Registering the Widget 

      Adjusting the IMessage Interface 

16. Securing Components.

    Step 1: Declaring Permissions 

    Step 2: Using the Permissions 

    Step 3: Declaring Roles 

    Step 4: Assigning Roles to Principals 

17. Changing Size Information.

    Step 1: Implementing the Adapter 

    Step 2: Writing and Running Unit Tests 

    Step 3: Registering the Adapter 

18. Internationalizing Packages.

    Step 1: Internationalizing Python Code 

    Step 2: Internationalizing Page Templates 

    Step 3: Internationalizing ZCML 

    Step 4: Creating Language Directories 

    Step 5: Extracting Translatable Strings 

    Step 6: Translating Message Strings 

    Step 7: Compiling and Registering Message Catalogs 

    Step 8: Trying the Translations 

    Step 9: Updating Translations on-the-Fly 


19. Events and Subscribers.

    Step 1: Developing the Mail Subscription Interface 

    Step 2: Implementing the Mail Subscription Adapter 

    Step 3: Testing the Adapter 

    Step 4: Providing a View for the Mail Subscription 

    Step 5: Writing an Event Subscriber 

    Step 6: Testing the Message Mailer 

    Step 7: Using the New Mail Subscription System 

    The Theory Behind Events 

20. Approval Workflow for Messages.

    Step 1: Making a Message Workflow-Aware 

    Step 2: Creating a Workflow and Its Supporting Components via a Browser 

    Step 3: Assigning a Workflow 

    Step 4: Testing the Workflow 

    Step 5: Creating a Review Messages View for Message Boards 

    Step 6: Adjusting a Message Thread 

    Step 7: Automating the Creation of Workflow and Friends 

    The Theory Behind Workflows 

21. Providing Online Help Screens.

    Creating Help Files 

    Registering the Online Help Topics 

22. Object-to-Filesystem Mapping, Using FTP as an Example.

    Step 1: IPlainText Adapters 

      The IPlainText Interface 

      The Plain-Text Adapter Implementation 

      The Configuration of the Adapters 

    Step 2: The Virtual Contents File Adapter 

      The Virtual Contents File Interface 

      The Implementation 

      The Tests for the VirtualContentsFile Class 

      The Configuration of the VirtualContentsFile Class 

    Step 3: The IReadDirectory Implementation 

      The Directory Implementation 

      The Directory Tests 

      The Directory Configuration 

    Step 4: Putting the Icing on the Cake: A Special Directory Factory 

23. Availability of Content via XML-RPC.

    Step 1: Creating Methods: XML-RPC Presentation Components 

    Step 2: Testing the XML-RPC Views 

    Step 3: Configuring the New Views 

    Step 4: Testing XML-RPC Features in Action 

24. Developing New Skins.

    Step 1: Preparing for a New Skin 

    Step 2: Creating a New Skin 

    Step 3: Customizing the Base Templates 

    Step 4: Adding a Message Board Intro Screen 

    Step 5: Viewing a List of All Message Board Posts 

    Step 6: Adding a Post to the Message Board 

    Step 7: Reviewing Pending Messages 

    Step 8: Viewing Message Details 

    Step 9: Replying to Messages 


25.Building and Storing Annotations.

    Implementing an Alternative Annotations Mechanism 

    Step 1: Developing the Interfaces 

    Step 2: Implementing the KeeperAnnotations Adapter 

    Step 3: Writing and Performing Unit Tests 

    Step 4: Configuring the KeeperAnnotations Component 

    Step 5: Writing Functional Tests and Configuration 

26. New Principal-Source Plug-ins.

    Step 1: Defining the Interface 

    Step 2: Writing the Tests 

    Step 3: Implementing the Plug-in 

    Step 4: Registering the Principal Source and Creating Basic Views 

    Step 5: Taking the Plug-in for a Test Run 

27. Principal Annotations.

    Step 1: Creating the Principal Information Interface 

    Step 2: Creating the Information Adapter 

    Step 3: Registering the Components 

    Step 4: Testing the Adapter 

    Step 5: Playing with the New Feature 

28. Creating New Browser Resources.

    Creating a Resource File 

      Image Resources 

      The DirectoryResource Object 

29. Registries with Global Utilities.

    Step 1: Defining the Interfaces 

    Step 2: Implementing the Utility 

    Step 3: Writing Tests 

    Step 4: Providing a User-Friendly UI 

    Step 5: Implementing ZCML Directives 

      Declaring the Directive Schemas 

      Implementing ZCML Directive Handlers 

      Writing the Meta-ZCML Directives 

      Testing the Directives 

    Step 6: Setting Up Some Smiley Themes 

    Step 7: Integrating Smiley Themes into the Message Board 

      The Smiley Theme Selection Adapter 

      Using the Smiley Theme 

30. Local Utilities.

    Step 1: Defining the Interfaces 

    Step 2: Implementing a Smiley 

    Step 3: Registering the Themes 

    Step 4: Providing Views 

    Step 5: Working with the Local Smiley Theme 

    Step 6: Writing Tests 

31. Vocabularies and Related Fields/Widgets.

    Step 1: The Vocabulary and Its Terms 

    Step 2: Testing the Vocabulary 

    Step 3: The Default Item Folder 

32. Exception Views.

    Step 1: Creating an Exception 

    Step 2: Providing an Exception View 

    Step 3: Testing the Exception View 


33. Writing New ZCML Directives.

    Step 1: Developing the Directive Schema 

    Step 2: Implementing the Directive Handler 

    Step 3: Writing the meta Configuration 

    Step 4: Testing the Directive 

34. Implementing TALES Namespaces.

    Step 1: Defining the Namespace Interface 

    Step 2: Implementing the Namespace 

    Step 3: Testing the Namespace 

    Step 4: Wiring the format Namespace into Zope 3 

    Step 5: Trying the format Namespace 

35. Changing Traversal Behavior.

    Step 1: Creating a Non-Case-Sensitive Folder 

    Step 2: Creating the Traverser 

    Step 3: Creating and Running Unit Tests 

    Step 4: Creating and Running Functional Tests 

36. Registering New WebDAV Namespaces.

    Step 1: Creating the Namespace Schema 

    Step 2: Implementing the IPhoto to IImage Adapter 

    Step 3: Unit-Testing and Configuring the Adapter 

    Step 4: Registering the WebDAV Schema 

    Step 5: Creating and Running Functional Tests 

37. Using TALES Outside Page Templates.

    The TALES Filesystem Runner 

    Trying Out the New TALES Runner 

38. Developing New TALES Expressions.

    An Overview of TALES Expressions 

    Step 1: Implementing the SQL Expression 

    Step 2: Preparing and Implementing the Tests 

    Step 3: Trying Your New Expression in Zope 

39. The Life of a Request.

    What Is a Request? 

    Finding the Origin of a Request 

    The Request and the Publisher 


    Part 40: Writing Basic Unit Tests 

    Part 41: Doc Tests: Example-Driven Unit Tests 

    Part 42: Writing Functional Tests 

    Part 43: Creating Functional Doc Tests 

    Part 44: Writing Tests Against Interfaces 

40. Writing Basic Unit Tests.

    Implementing the Sample Class 

    Writing Unit Tests 

    Running the Tests 

41. Doc Tests: Example-Driven Unit Tests.

    Integrating a Doc Test 

    Doc Tests in a File 

    Shortcomings of Doc Tests 

42. Writing Functional Tests.

    The Browser Test Case 

    Testing ZPT Page Views 

    Running Functional Tests 

43. Creating Functional Doc Tests.

    Setting Up the Zope 3 Environment 

    Setting Up TCPWatch 

    Recording a Session 

    Creating and Running the Test 

44. Writing Tests Against Interfaces.

    The ISample Interface 

    The ISample Interface Tests 

    Implementations of the ISample Interface 

    Writing Tests for the Implementations 

    Running the Tests 

Appendix A. Attribution-NonCommercial-NoDerivs License 2.0.

Appendix B. Zope Public License (ZPL) Version 2.1.




Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020