Personal tools
You are here: Home Zope Zope3宝典
Document Actions

FrontPage

by 潘俊勇 last modified 2005-12-14 14:28

http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/FrontPage/Zope3Book

(Zope 3 Developers Book - An Introduction for Python Programmers)

Zope3开发人员用书 - 给Python程序员的介绍 =======================================

:Status: IsEditedDraft?

The Zope 3 Developers Book aims to provide a solid, but gentle, introduction into the advanced concepts and implementations of the Zope 3 Framework. This book requires some knowledge about Python itself and is therefore aimed at Python and Zope developers, which are interested in the Zope 3 internals, instead of developing Web-based applications. It is the hope of the Zope 3 development community that this complete rewrite of Zope will attract a wider range of Python developers, since many components can be reused completely independent of Zope.

This book is not intended to cover every single aspect of the Zope 3 core software, but serve as a starting point by providing chapters that go into great detail instead of covering a wide range of information. The reader should be able to go to a chapter, read it and after understanding the material know how to complete the original task.

The completed book will be published by Sams Publishing under a free content license in the second or third quarter of 2004. It will be part of the Developer's Library. Much thanks goes to Shelley Johnston (Acquisitions Editor for Sams) for giving us this opportunity. The main author of the book is Stephan Richter and the technical editing will be done by Jim Fulton and Steve Alexander.

I appreciate any contribution to the book, whatever form it may take from correcting spelling/grammar, making technical comments and even writing a chapter/recipe. All contributions will be properly credited in any publication form of the book. If you have any questions, do not hesitate to contact me on the Zope 3 Dev list or at srichter@cosmos.phy.tufts.edu

Thanks, StephanRichter?

Preface: 绪言 对Zope的简单介绍

  1. 从用户视角看Zope3 This section concentrates on getting Zope 3 setup on your computer.
    1. 安装Zope 3 InstallZope3 Before you can go on trying all the code snippets provided by the following chapters and recipes, you need to install Zope 3 on your system. This introduction chapter will only cover the basic installation and leave advanced setups for the following chapters to cover.
    2. 新的web用户界面 WebGUI While this has not much to do with Python development, one must be comfortable with the GUI interface, so that s/he can test the features of the new code effectively. Furthermore, the TTW development interface will be briefly introduced.

      Note: The original futuristic version of this chapter is still available as [Zope3GUI]?. Since Zope X3 3.0.0 does not ship with any scripter or TTW development support, these sections have been removed from the current text.

    3. 安装新的ZOpe包(Zope Packages): InstallPackages A simple chapter for installing packages in your Zope 3 installation.
    4. 和Apache一起设置一个虚拟主机环境 VirtualHosting This chapter describes how to setup virtual hosting in Zope 3, such as it is required for using Apache in front of Zope 3.
    5. 把通过Web编写的代码(Through-The-Web Code)和文件系统同步 SyncTTWCodeToFS Zope 3 will come with an advanced ZODB to Filesystem synchronization tool, similar to CVS. This will allow people to make local copies of their sites work on it and check in the changes and much more. This recipe will explain how to effectively use this tool.

      Note: This chapter will not be included in the first version of the book, since Zope X3 3.0.0 will not ship with it and it is not actively maintained at this point.

  2. The Ten-Thousand Foot View Here an overview over some of the fundamental ideas in Zope 3 is given without jumping into the technical detail. The reader might prefer to read these chapters after reading some of the more hands on sections, like the ones that follow.
    1. Zope 3 开发过程 DevProcess This chapter briefly introduces the process that is used to develop and fix components for Zope 3.
    2. 接口(Interfaces)的介绍 Interfaces Since Interfaces play a special role in Zope 3, it is important to understand what they are used for and what they offer to the developer.
    3. 组件架构(Component Architecture) - 一个介绍 Components An overview over components and their possible interaction.
    4. "Zope Schemas and Widgets (Forms)" [Schema]? One of the powerful features coming up over and over again in Zope 3, are schemas, an extention to interfaces that allows attributes to be specified in more detail allowing autogeneration of forms as well as the conversion and validation of the inputted data.
    5. 介绍Zope 配置标记语言 ZCML While you are probably familiar with ZCML by now, it is always good to review.
    6. 介绍Zope的I18n和L10n支持 I18NOverview This introduction presents the new I18n and L10n features of Zope 3 and demonstrates how a developer can completely internationalize his/her Zope application. I18n in ZPT, DTML, ZCML and Python code will be discussed.
    7. 元数据和Dublin Core DublinCore Everyone knows about it, everyone talks about it, but few know the details. Naturally, the fields of the Dublin Core will be discussed and how they can and should be used.
    8. 移植应用 PortingApps For many developers it is very important to have a migration path from their Zope 2 applications to Zope 3. This chapter will concentrate on the technical aspects and discuss the design changes that have to be applied to make an old Zope application fit the new model. The port of ZWiki? will be used as an example.
  3. Content Components - 基础 This section deals with the creation of content objects and basic functionality around them. In order to make the recipes flow better, they will be all guided by the creation of a simple message board.
    1. 编写一个新的内容对象 ContentObject This recipe will describe how to implement a new simple Content Object.
    2. 添加视图 ComponentViews This recipe will demonstrate various methods to create Browser-specific views for a component.
    3. 定制Schema Fields 和Form Widgets FieldsAndWidgets This recipe basically tells you how to implement your own field and corresponding widget. It will then be demonstrated how this Field and Widget can be used in a Content object.
    4. 组件安全性 SecureObjects Zope 3 comes with an incredible security system; but the best system is only as good as the end developer using it. This recipe will give some hands-on tips and tricks on how to make your code secure.
    5. 改变大小(Size)信息 Size There exists a small interface for content objects that will allow them to display and compare their size. This is a short recipe explaining this feature.
    6. 国际化一个包 I18N This recipe will give step by step instructions on how to internationalize the content object we developed in the previous recipes and how to create a German translation for it.
  4. Content Components - 高级技术 Having a well-working basic message board is great, but it is certainly not blowing away anyone. In this section some more advanced APIs? are presented.
    1. 事件和订阅 Events Events et al are a very powerful idea. This chapter will explain how to write your own event subscribers by implementing a mail subscription feature for messages.
    2. 消息的审批工作流(Approval Workflow for Messages) Workflow This chapter will show how to integrate an editorial workflow for a content component.
    3. 提供在线帮助屏幕 Help Every good application should have Online Help screens, which is outlined in this chapter.
    4. 使用FTP为例介绍对象到文件系统的映射 FS While there are standard hooks for content objects to be handled by FTP, it is often useful to write your own FTP handlers, so that the file-to-object conversion (and the other way around) seems more natural.
    5. 使用XML-RPC访问 XMLRPC - If you want to make XML-RPC calls on your content objects, you must write a view declaring the methods and define how their output is mapped to a type that XML-RPC understands.
    6. 开发新的外观 Skin This chapter gives instructions on how to implement a new skin, so that sites can be developed that do not look like the Zope Management Interface, but still allows us to make use of all the auto-generation of forms.
  5. 其他组件 From the introduction chapters you know that content objects are not the only type of component you want to write. This section covers several of these various other components, such as utilities and resources.
    1. 构建和存储评注信息 Annotations Since it is desirable to leave an object as untouched as possible, we developed a mechanism for attaching meta data to an object without the object knowing about it.
    2. 新Principal-source plugins PrincipalPlugin Many people have very different requirements on the mechanism an authentication service should function and Zope 3 respects this need. There exists an Authentication Service that accepts plugins to provide principal data from external data sources.
    3. Principal Annotations PrincipalAnnotation A common task is to append data to principals. Since principals are often imported from external data sources, they are not attribute annotatable. This chapter will make use of the Principal Annotation service to store additional data.
    4. New Resources Resource This is a short chapter telling the reader how to implement a new file system based resource (a context independent view).
    5. Registries with Global Utilities GlobalUtility Utilties can be used to implement Zope-wide registries. Since registries are so very useful, this chapter is a must.
    6. Local Utilities LocalUtility While we saw already how simple it is to write global utilities, there is some more work to do for local utilities, which will be introduced in this chapter.
    7. 开发一个基于Lucene的全文索引 LuceneTextIndex While there are many indices that will be shipped with Zope 3, it is sometimes necessary to write an index that makes use of external indexing software for example, such as Lucene or many other. This recipe will explain in detail on how to connect Lucene to Zope 3 as a full-text indexing engine.

      Note: This chapter will not be included in the first version of the book, since Zope X3 3.0.0 will not ship with index support and it has already been totally rewritten for 3.1.

    8. Vocabularies and Related Fields/Widgets Vocabularies Vocabularies are a powerful extension to the schema framework and provide a generic method to create fields with variable and context dependent selection lists.
    9. Exception Views ExceptionViews For Zope 3, exceptions are simply objects, which can have views that make them representable on any output medium (usually the browser). Every exception has a standard view, but for a professional Web site you will need better screens.
  6. 高级话题 Not everything you ever want to develop are components that you would allow the user to add and manipulate. This section contains a collection of chapters that deal mainly with the packages outside of zope.app. These packages are often useful outside of Zope 3 as well.
    1. 编写新的ZCML指令 ZCMLns? Here we iscusses how new directives can be added to a ZCML namespace using meta-directives and/or how to create a new namespace from scratch.
    2. 实现新的TALES名字空间(Name Space) TALESns? In Zope 3, Zope Page Templates (TALES expressions) can contain namespaces to provide easier access to an object's data and meta-data. While Zope 3 provides a zope namespace, it is sometimes extremely helpful to develop your own to expose your product-specific API.
    3. 改变Traversal行为 [Traversal]? Similar to Zope 2, one can change the traversal (lookup) behavior for an object, except that this functionality is much more flexible in Zope 3.
    4. 注册一个新的WebDAV名字空间 WebDAVns? WebDAV? is allowed to store and request any namespace on any resource. However, we want to have some control over the namespaces and their values. This chapter explains how to bind Zope 3 attributes and annotations to WebDAV? namespaces.
    5. 在页面模板(Page Template)外使用TALES [TALES]? TALES is a powerful expression mechanism that certainly does not only find usage in Page Templates. This chapter tells you how to incorporate TALES into your own Python applications and scripts.
    6. 开发新的TALES表达式 TALESExpr? While TALES is powerful in itself, one can make it even more powerful by implementing custom expressions. The chapter will explain step by step how the sql expression was created.
    7. Spacesuits -- Objects in Hostile Environements SpaceSuits? While the term "spacesuits" is not used in the Zope 3 terminology anymore, it best describes the approach of the new security model, which will be introduced in this chapter.
    8. 请求(Request)的活动过程 Request This chapter will show the request's exciting journey through the server, publisher and publication frameworks.
  7. 编写测试 Writing tests for every bit of functionality is of upmost importance in Zope 3. Testing can be done in many ways, from Java-like unit tests to pythonic Doc Testing.
    1. 编写基本的单元测试 UnitTests? This chapter shows you how to develop basic unit tests for your code and explains in detail how various pieces of functionality can be tested.
    2. "Doctests: Example-driven Unit Tests" DocTests? Sometimes regular unit tests are not as instructive to someone reviewing the code. In these cases it is shown how example-driven doctests can be useful.
    3. 编写功能测试(Functional Tests) FTests? Unit tests are great for testing isolated components, but are impractical for testing entire sections of the system. For these type of tests we use a functional testing framework, which is introduced here in some detail.
    4. "Writing Function Doc Tests" FDocTests? For the same reason doctests were developed to supercede unit tests, functional doctests are intended to be a more descriptive solution to develop functional tests.
    5. "Writing Tests Against Interfaces" IFaceTests? If an interface is commonly implemented multiple times, it is a good idea to write tests directly against the interface as a base for the implementation tests. This chapter will show you how to do that and expand on the motivation.

附录 A: 词汇表 [Glossary]? A glossary of terms for the book. This differs from the official Wiki glossary and is meant to give a different perspective. I intentionally did not look at the existing glossary or its list of terms, so that this one would provide a unique point of view.

附录 B: 鸣谢 [Credits]? This mini section contains a list of all contributors to the cookbook. I want to give everyone the proper credit.

附录 C: Creative Commons License This book is licensed under the "Creative Commons Attribution-NoDerivs?-NonCommercialLicense?" 1.0.

附录 D: Zope Public License 2.0 The example code is maintained in the Zope CVS under the ZopePublicLicense?.


Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: