The Plone Content Management System is one of the best open source CMS because, by using Plone’s development framework, you can extend its functionality according to the specific requirements of your website. The Plone framework has lots of components that can be used to create add-ons or extensions called Plone Products. You can optimize your site for improved usability, accessibility, and security, by creating custom Plone products.
This book covers recipes that will help you create custom Plone Products and implement them on your website. Every topic covered in this book is accompanied by essential fundamentals and step-by-step explanations that will help you understand it better. With the help of this book you will be able to create custom Plone products that are well suited to your website.
Chapter 1, Getting Started will introduce the reader to the project that will be developed: a news website with banners hosted in OpenX. It will also cover the tools a Plone developer must have before starting a project.
Chapter 2, Using Development Tools, will show you how to install and use special tools that we often need to find problems (debug), modify code on the fly, or get help on tasks during the development phase of a project.
Chapter 3, Creating Content Types with ArchGenXML, will introduce the ArchGenXML technology by creating a new content type (based on an existing one), and will wrap the final product into a Python egg. It is a great tool to help with the development of Archetypes-based content types.
Chapter 4, Prevent Bugs through Testing, will show how automatic testing helps preventing the malfunctioning of features due to lack of communication or ignorance of some parts of code when projects evolve or the development team changes.
Chapter 5, Creating a Custom Content Type with Paster will cover the creation of Archetypes content types from scratch by hand... kind of. We will actually use paster to automatically create most of it.
Chapter 6, Creating Lightweight Content Types, will introduce other technologies to create lighter content types. (Archetypes is a great, though very large, framework developing content types.)
Chapter 7, Improving Product Performance, will teach you how to reap the benefits of Plone by dealing with the problem of creating content types in which the objects’ final HTML rendering performs badly, and how to benchmark these improvements.
Chapter 8, Internationalization, will cover the different tools used to offer a properly internationalized product.
Chapter 9, Adding Security to our Products will go through the steps to secure tasks and content types: permissions, roles, groups, workflows, and configuration options.
Chapter 10, Improving User Interface with KSS, will introduce the use of KSS — an Ajax framework that allows UI development without writing any JavaScript, in Plone by creating from simple client-side visual changes to server-side objects manipulation.
Chapter 11, Creating Portlets, will give you step-by-step instructions for adding portlets. Portlets are used to provide contextual information about the main contents of a page.
Chapter 12, Extending Third Party Products, will deal with what to display in the final web page and how, and will show how to add new features to existing components.
Chapter 13, Interacting with Other Systems: XML-RPC will go through some essential Python modules which are used in the advertisement service to communicate with an external non-Python-based system.
Chapter 14, Setting our Products Ready for Production, will help you create your own products repository and be ready for the website launch. After finishing the development of the products, we must make them available for future use or evolution.
Appendix, Creating a Policy Product, will introduce a special kind of product to deal with site installation, configuration, and customization with code, instead of using manual actions that are likely to be forgotten.
Although this is a cookbook, we won’t give isolated recipes for each individual task, we’ll follow a common theme throughout the book to make it easy to understand.
Some of the topics that we cover may not be all together in one chapter because:
They don't require a whole chapter or section but are better explained in different stages of the development project.
They need an introduction and will be complemented with tips later in the book.
Examples of these subjects are buildout recipe configuration and code testing.
In addition, we’d like to mention that, for ease of explanation and understanding, we approached the writing of the book as if this were a website project commissioned to us by a customer.
The project we are tackling is the design of a digital newspaper website with a particular requirement: the customer needs, with equal importance, to publish pieces of news and to insert advertisements all over the place.
Below is a summarized list of the functionalities the customer requested and we will cover in this book. We will include details related to specific things that Plone doesn’t provide out of the box.
News items will be published in several sections and must include fields like country and lead paragraph or intro.
Multimedia content will illustrate and complement written information.
Multimedia content should be played online but may also be downloaded.
Advertisement banners will be located in several areas of every page.
Advertisement banners may vary according to the section of the website.
Commercial (and non-technical) staff should be able to modify the location of the banners.
All sections will have a front page with a special layout including the last published content.
In addition, the customer is planning to release a Spanish version of the website in the near future. So they also require that:
Everything in the website must be translated or, at least, be translatable into other languages.
There are also two additional requirements that are not particular to this project but to everyone, and are related to the quality of the final product:
Accessing the website must be fast, especially for readers.
All of the code must be properly commented and tested so that future changes can be made, without too much effort, by a different development team.
Of course, the customer has his own branding, so they need the website to have a distinctive look and feel. This part of the project will be developed by another company (that will not be covered in this book). The process of creation and applying visual design to a Plone site is called skinning. The result of this process is called the skin or theme, which is usually contained in a single Plone product.
Note
Take a look at the list of ready-to-use themes at: http://plone.org/products/by-category/themes.
To follow all the recipes of this book you merely need a Linux or Windows system that can run Python 2.4 or above. There are only two recipes, however, that are intended for Linux only.
This book is for programmers who have some knowledge of Python, Plone, and Zope. If you want to develop feature-rich add-on products in Plone, this book is for you. It is aimed at the development of backend features, so you need not have other web-related skills such as HTML, CSS, or JavaScript.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: “Uses a plone.recipe.zope2instance
recipe to install a Zope instance.”
A block of code is set as follows:
find-links = http://dist.plone.org/release/3.3.3 http://dist.plone.org/thirdparty
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
[buildout] parts = python virtualenv make-virtualenv # Add additional egg download sources here. # dist.plone.org contains archives # of Plone packages.
Any command-line input or output is written as follows:
# aptitude install gcc g++ libbz2-dev zlib1g-dev libreadline5-dev libssl-dev
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: “In Plone literature, they are called products, though”.
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>
, and mention the book title via the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail <[email protected]>
.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book on, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Tip
Downloading the example code for the book
Visit https://www.packtpub.com//sites/default/files/downloads/6729_Code.zip to directly download the example code.
The downloadable files contain instructions on how to use them.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
You can contact us at <[email protected]>
if you are having a problem with any aspect of the book, and we will do our best to address it.