Zope 3 Developer's Handbook

Stephan Richter

  • 出版商: SAMS
  • 出版日期: 2005-01-20
  • 售價: $2,170
  • 貴賓價: 9.5$2,062
  • 語言: 英文
  • 頁數: 456
  • 裝訂: Paperback
  • ISBN: 0672326175
  • ISBN-13: 9780672326172
  • 已過版

買這商品的人也買了...

相關主題

商品描述

Description:

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.

 

Table of Contents:

Introduction.

    Powerful Python 

    In the Beginning There Was… 

    Zope 3 Components 

    The Goals of This Book 

I. ZOPE 3 FROM A USER’S POINT OF VIEW.

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.

II. THE TEN-THOUSAND-FOOT VIEW.

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.

    Services 

    Adapters 

    Utilities 

    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 

    Locales 

    Messages and Message Catalogs 

    Internationalizing Message Strings 

      Python Code 

      ZPT  

      DTML 

      ZCML 

    Extracting Message Strings 

11. Metadata and the Dublin Core.

    The Dublin Core 

    The Dublin Core Elements 

      Title 

      Creator 

      Subject 

      Description 

      Publisher 

      Contributor 

      Date 

      Type 

      Format 

      Identifier 

      Source 

      Language 

      Relation 

      Coverage 

      Rights 

    Further Readings 

12. Porting Applications from Zope 2 to Zope 3.

    Porting an Application by Redesign 

    Porting Using Compatibility Layers and Scripts 

III. CONTENT COMPONENTS–THE BASICS.

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 

IV. CONTENT COMPONENTS–ADVANCED TECHNIQUES.

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 

V. OTHER COMPONENTS.

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 

VI. ADVANCED TOPICS.

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 

VII. WRITING TESTS.

    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.

    Disclaimer 

Index.