Zope concepts and architecture

  
                  

1. Basic Concepts

The Zope framework has some basic concepts that are understood to help make full use of Zope.

1.1. Zope is a framework

Zope covers many of the underlying details that web application developers need to deal with, such as data persistence, data integrity, data access control, etc. This will allow you to concentrate on solving problems. Zope allows you to take advantage of the services provided by Zope to build web applications faster than other languages ​​or frameworks. Zope lets you write the logical processing part of a web application using the Python language, and of course you can use Perl. Zope also offers two methods, like templates, to process data such as text, XML, and HTML, a text template markup language (DTML) and a Zope page template (ZPT).

1.2. Object-Oriented

Unlike file-based Web template systems such as ASP or PHP, Zope is a highly object-oriented Web development platform. Many languages ​​support object-oriented concepts, including writing Zope's Python language. Common Web scripting languages ​​such as Perl or PHP support object-oriented features. Reading the "Object-Oriented" chapter can help you understand the concept in depth, and you can use the examples provided in this book to understand the concept.

1.3. Object Publishing


The basic idea of ​​Zope is that the foundation of the Web is object-oriented. The URL to a web resource is actually the path to the object in the object container. The HTTP protocol provides a way for an object to send a message and receive a response.

Zope's object structure is hierarchical, that is, a typical Zope site is composed of objects, and the object may contain other objects. Depending on the name of the object, Zope maps to the object by URL in a hierarchical structure. For example, the URL "/Marketing/index.html" can be used to access a document object named "index.html" in the folder object "Marketing".

Zope is "publishing" the objects you create in such a direct way. The basic process is as follows:

The browser sends a request to the Zope server. The requested URL format is: protocol://host:port/path?querystring, for example:

http://www.zope.org:8080/Resources?batch_start=100

Zope The URL is broken down into: "host", "port", "path" and "query string".

(http://www.zope.org, 8080, /Resources and ?batch_start=100, respectively)

Zope locates in the object database according to the path (path, ie /Resources) Object. Zope executes this object with the passed arguments. If the result of the object execution returns a value, the value is sent back to the browser. Usually return HTML, file data or graphic data. The browser interprets the received data and displays it.

The URL of a Zope object consists of the id of the folder containing the object and the object, separated by the /symbol. For example: /Uncles/Bob, call Bob in the Uncles directory.

also like:

/Uncles/Rick

/Uncles/Danny

/Uncles/Louis

The full URL can be Yes: http://localhost:8080/Bob. For a more detailed explanation, please refer to: Object Publishing in the Zope Development Guide. Object Publishing

1.4. Managing via the Web

Zope can create and process various types through the browser. Object. The management interface provided by Zope is like the resource manager in Windows. Objects can be placed anywhere in a hierarchy, and site managers manage objects by clicking on different views of the object. Different objects have different views. For example, the "DTML Method" object has a view labeled "Edit" in which the code can be edited, and the "Database Connection" provides a view that modifies the connection and parameters. All objects have a "Security" view for managing access rights control.

1.5. Security and Authorization

A distinguishing feature of Zope from other application servers is the close integration of the Web object model with the Web development model. This allows many different people to participate, and Zope allows secure authorization for different users, allowing page designers, database administrators, and content administrators to work together.

Successful Web sites require a lot of people to participate, such as application developers, SQL administrators, content administrators, and even end users. At this point, security issues become important. How to control and how to assign permissions? Objects in Zope provide a much richer security license than traditional file-based systems. Different objects can have different security restrictions. For example, for a "SQL Method" object, you can allow the user to call it, but you cannot change or view the source code. You can also restrict users from creating only certain types of objects, such as folders or DTML documents, but not SQL Method objects.

Zope manages users through "User Folders". User information is included in this special folder. User folders can also be extended by adding extension packages, which can be managed through relational databases or LDAP directories. The ability to add new user folders can be assigned to users in the subordinate folders, allowing your approved users to manage a section of the site.

1.6. Local object persistence and transaction (Persistence and Transactions)

Zope object is stored in a high-performance object database supporting transaction mechanism, namely Zope object database (ZODB). The database considers each web request to be a separate transaction. During a web request, any changes made will be cancelled if an error occurs during execution. The object database also supports multi-level undo, which allows site administrators to undo changes simply by clicking the "undo" button. All ways of implementing object persistence and transactions in the Zope framework are transparent to developers. Relational databases are still valid in the Zope framework.

1.7. Acquisition (Acquisition)

Acquisition is a very important concept in Zope. The concept is simply:

Zope objects can be Included in other objects (such as folders). Objects can "get" the properties and behavior of their container objects.

All Zope objects support fetching, which provides a very powerful way to manage various resources. For example, a frequently used SQL query or a small piece of HTML code can be defined in a folder, and the subordinate folder can be called automatically by "getting" such a mechanism. If this SQL query has been modified, don't worry about the subordinate folder. This modification is valid for all subordinate folders.

Because the search object is obtained by hierarchically from the current directory, it is easy to specify the effective range. For example, there is a folder "Sports" that contains sports content, and you can create new header and footer files in this folder. This allows the two files to be called in the "Sports" folder and the subordinate folder. The files in the "Sports" parent folder will not be called.

This concept will be covered in detail in the "Getting" chapter.

1.8. Zope is extensible

Zope is highly scalable and can be used in a variety of ways. Create a new Zope object, either by writing a new extension module in the Python language or by creating it entirely over the Web. Zope already includes a number of built-in components that can help with extensions. Zope already includes a set of framework classes that are used to handle details when creating new Zope objects.

Zope already has a number of extensions that enhance Zope's capabilities, such as adding forums, data processing, XML tools, and e-commerce programs. Most of these programs are written by Zope enthusiasts, and most are open source.

2. Basic Zope Components

Zope is made up of a number of different components to help you build web applications.

Zope Architecture


Description:

ZServer

This is Zope's built-in web server for content services. The web server also provides services via FTP, WebDAV? and XML-RPC protocols.


Web Server (Web Server)

Zope can also be combined with existing Web Server, such as Apache or Microsoft IIS, and other support for common gateway interfaces ( CGI) web server.

Zope Core (Zope Core)

This is Zope's core engine, which controls how to display, as well as control the management interface and object database.

Object Database

When using Zope, most of the time it is processing objects stored in the Zope object database.

Relational database

Data does not have to be stored in the Zope object database, Zope can use other relational databases, such as Oracle, PostgreSQL?, Sybase, MySQL, etc. Wait.

File System

Zope can also use documents and other files stored in the server file system.

ZClasses

You can add new objects by using the web administration interface. ZClasses? is such an object.

Products

Zope can also add new objects by installing a "product" file in the file system on the Zope server.

Copyright © Windows knowledge All Rights Reserved