The Zope Book (2.6 Edition)
Amos Latteier, Michel Pelletier, Chris McDonough, Peter Sabaini
The Zope Book (2.6 Edition)
2
Preface 32
How the Book Is Organized 32
Conventions Used in This Book 34
Contributors to This Book 35
Introducing Zope 36
What Is A Web Application? 36
How You Can Benefit From Using An Application Server 37
Zope History 38
Why Use Zope Instead of Another Application Server 38
Zope Audiences and What Zope Isn't 39
Zope's Terms of Use and License and an Introduction to The Zope Community 40
Zope Concepts and Architecture 41
Fundamental Zope Concepts 41
Zope Is A Framework 41
Object Orientation 41
Object Publishing 41
Through-The-Web Management 42
Security and Safe Delegation 42
Native Object Persistence and Transactions 43
Acquisition 43
Zope Is Extensible 43
Fundamental Zope Components 44
Installing and Starting Zope 45
Downloading Zope 45
Installing Zope 45
Installing Zope for Windows With Binaries from Zope.org 46
Installing Zope on Linux and Solaris With Binaries from Zope.org 50
Compiling and Installing Zope from Source Code 52
Starting Zope 53
Using Zope With An Existing Webserver 54
Starting Zope On Windows 54
Starting Zope on UNIX 54
Starting Zope As The Root User 55
Your Zope Installation 55
Logging In 56
Controlling the Zope Process With the Control Panel 57
The Zope Book (2.6 Edition)
3
Controlling the Zope Process From the Command Line 57
Troubleshooting 58
Options To The Zope start or start.bat Script 58
Environment Variables that Effect Zope at Runtime 61
When All Else Fails 65
Object Orientation 66
Objects 66
Attributes 67
Methods 67
Messages 67
Classes and Instances 68
Inheritance 68
Object Lifetimes 69
Summary 69
Using The Zope Management Interface 70
Introduction 70
How The Zope Management Interface Relates to Objects 70
ZMI Frames 70
The Navigator Frame 70
The Workspace Frame 71
The Status Frame 72
Creating Objects 72
Moving and Renaming Objects 73
Transactions and Undoing Mistakes 75
Undo Details and Gotchas 76
Reviewing Change History 76
Importing and Exporting Objects 77
Using Object Properties 80
Using the Help System 82
Browsing and Searching Help 82
Logging Out 83
Using Basic Zope Objects 84
Basic Zope Objects 84
Content Objects: Folders, Files, and Images 84
Folders 84
Files 84
Creating and Editing Files 85
The Zope Book (2.6 Edition)
4
Editing File Contents 86
Viewing Files 86
Images 87
Presentation Objects: Zope Page Templates and DTML Objects 87
ZPT vs. DTML: Same Purpose, Different Audiences 88
Zope Page Templates 89
Creating A Page Template 89
Editing A Page Template 89
Uploading A Page Template 89
Viewing A Page Template 90
DTML Objects: DTML Documents and DTML Methods 90
Creating DTML Methods 91
Editing DTML Methods 91
Viewing a DTML Method 92
Uploading an HTML File as Content for a DTML Method 92
Logic Objects: Script (Python) Objects and External Methods 93
Script (Python) Objects 93
Creating A Script (Python) 94
Editing A Script (Python) 94
Testing A Script (Python) 94
Uploading A Script (Python) 95
External Methods 96
Creating and Editing An External Method File 96
Creating an External Method Object 96
Testing An External Method Object 96
SQL Methods: Another Kind of Logic Object 97
Creating a Basic Zope Application Using Page Templates and Scripts 97
Creating a Data Collection Form 98
Creatng A Script To Calculate Interest Rates 98
Creating A Page Template To Display Results 99
Dealing With Errors 99
Using The Application 100
The Zope Tutorial 100
Acquisition 102
Acquisition vs. Inheritance 102
Acquisition is about Containment 103
Say What? 103
The Zope Book (2.6 Edition)
5
Providing Services 104
Getting Deeper with Multiple Levels 104
Summary 104
Basic DTML 106
How DTML Relates to Similar Languages and Templating Facilities 106
When To Use DTML 106
When Not To Use DTML 106
The Difference Between DTML Documents and DTML Methods 107
Details 107
DTML Tag Syntax 108
DTML Tag Names, Targets, and Attributes 108
Creating a "Sandbox" for the Examples in This Chapter 109
Examples of Using DTML for Common Tasks 109
Inserting Text into HTML with DTML 109
Formatting and Displaying Sequences 111
Processing Input from Forms 112
Dealing With Errors 115
Dynamically Acquiring Content 115
Using Python Expressions from DTML 117
DTML Expression Gotchas 119
will call the method. However, 119
Common DTML Tags 120
The Var Tag 120
Var Tag Attributes 120
Var Tag Entity Syntax 121
The If Tag 121
Here's an example condition: 121
Name and Expression Syntax Differences 122
Else and Elif Tags 122
Using Cookies with the If Tag 123
The In Tag 124
Iterating over Folder Contents 124
In Tag Special Variables 125
Summary 127
Using Zope Page Templates 128
Zope Page Templates versus DTML 128
How Page Templates Work 128