Версия 1 от 2010-06-12 21:51:23

Убрать это сообщение

Учебник - часть 2

Введение

This is the second part of the tutorial. In the first part, you learned about project directory structure, Buildout configuration, content components and using the form library. Content components are objects with a user visible view. A view could be a browser view (HTML/JS/CSS) or JSON or XMLRPC or any other view. To explain the idea of content components, the ticket collector project started in the first part of tutorial will be expanded with additional functionality. In fact, the collector object created in the last chapter is a content component. In this chapter, you will create new content objects like tickets and comments. Another thing that should be noted is that every content component, including container components, has well defined interfaces.

This chapter explores content components in more detail. After completing this chapter, you should be able to:

Define schema for content components Create container objects Use ZCML to configure various components Before proceeding further, here is an overview of what we will cover:

Adding tickets – In this section you will create a ticket object. We provide a detailed overview of creating content objects and demonstrate with a simple example. Listing tickets – Next you will see how to display tickets from the main collector page. Adding comments – Here you will learn how to add content objects inside other container objects. Ticket objects will be transformed to container objects. Listing comments – In this section you will develop a comment object and write the code needed to display comments on the ticket page. Note The examples in this documentation can be downloaded from here: http://download.zope.org/bluebream/examples/ticketcollector-1.0.0.tar.bz2 The source code is available in different stages corresponding to sections. Stage 1 : Section 5.2 to 5.7 Stage 2 : Section 5.8 Stage 3 : Section 5.9 Stage 4 : Section 6.2 Stage 5 : Section 6.3 Stage 6 : Section 6.4 & 6.5