Developing for Plone

In This Section...

Archetypes

Creating a Content Type for Plone 3 for developers
So you have installed Plone now you want to get to the business of filling it with all of your content. You start by searching on the Plone website for a way to create your own custom content type so you can begin management of the data. However, it’s all a confusing mess to you; you’re a halfway decent programmer, but you’re not a brain surgeon and you want to go to lunch today. Here is a straight-forward and quick way to do this with a Plone 3.x installation.
Plone Developer Cheatsheet
A single list of every technology you need to learn, in the order you need to learn them.
Adding Charts To Your Custom Content Type
Step-by-step instructions for adding Python-generated charts to your custom Archetype. I describe a general method that allows you to use any Python graphing libraries that output images (png, gif, jpg, etc.). I use PyChart in this specific example.
Archetypes - Getting Started
We will create a rental business as a new product based on Archetypes.
Creating your own Custom Member Content-types with Archetypes and ReMember
This tutorial teaches you how to create your own custom site membership product.
Design a user-friendly form to update multiple ReferenceFields
The end result of this how-to is a design pattern for making a customized widget to wrangle an array of AT Reference Fields. The true purpose of the how-to is to document one process for semi-technical Plone developers to move from problem to solution.
Fixing Plone's publishing of Flash content in Plone 3.1.6 and earlier
How to make Flash Player 10 display Flash content uploaded as content to the site.
Migrate Custom AT Types with Products.contentmigration
How to migrate the custom archetype types that you have created using Products.contentmigration. Appropriate for changing field names, package names, or types from one to another.
RichDocument: Creating content types the Plone 2.1 way
This tutorial will teach you how to create content types the Plone 2.1 way, using the ATContentTypes library, by following the example of RichDocument, an extension of Plone's standard Page/Document type.
Tagging your content using custom content types
Tagging is a nice way of connecting content within your Plone site (and outside of your Plone site too). Here's how to add this functionality to your own content-types and place the associated field in their main edit page.

Archetypes: Creating and Extending Content Types

Creating a Content Type for Plone 3 for developers
So you have installed Plone now you want to get to the business of filling it with all of your content. You start by searching on the Plone website for a way to create your own custom content type so you can begin management of the data. However, it’s all a confusing mess to you; you’re a halfway decent programmer, but you’re not a brain surgeon and you want to go to lunch today. Here is a straight-forward and quick way to do this with a Plone 3.x installation.
Plone Developer Cheatsheet
A single list of every technology you need to learn, in the order you need to learn them.
Adding an index to the portal catalog
How to add a new index to the portal catalog
Adding Charts To Your Custom Content Type
Step-by-step instructions for adding Python-generated charts to your custom Archetype. I describe a general method that allows you to use any Python graphing libraries that output images (png, gif, jpg, etc.). I use PyChart in this specific example.
Applying a custom view to a specific folder
How to create a one-off view for a particular folder in your site.
Creating a custom template for a Plone content type
So you've just finished reading about how to create a content type in Plone. You've got your content-type and you've entered most of your data but now you want to display it in your own template. Which means you want to learn how to create a custom or what we call browser view for that content type.
Creating your own Custom Member Content-types with Archetypes and ReMember
This tutorial teaches you how to create your own custom site membership product.
Customizing content object form behavior
Adding new form buttons or different action after successful content object save are usual use cases. This how to will give pointers how to customize the behavior of Archetypes content types.
Enable Collection Indices (fields for searching) for custom types
How-to enable usage of Collections for AT-based content types with custom schema fields
How to search in file fields in custom content-types
If your custom content type contains a file upload field, there's a good chance you want the uploaded files to be indexed, too. The key to get this done is TextIndexNG. This how-to will hopefully get you started quickly. Note that it's intended for Plone 2.5.
Make AT Content Type untranslatable with Products.LinguaPlone Installed
With Products.LinguaPlone installed, all the AT Content Types provide ITranslatable interface. This How-to explains the way to get rid of ITranslatable interface to avoid translating the content type.
RichDocument: Creating content types the Plone 2.1 way
This tutorial will teach you how to create content types the Plone 2.1 way, using the ATContentTypes library, by following the example of RichDocument, an extension of Plone's standard Page/Document type.
Slide Sorter
Create a view for sorting images (and potentially other content) which are displayed in a grid layout, where by each item occupies a single cell rather than a whole row. This uses a modified version of the javascript that powers the drag and drop functionality of folder_contents.
Storing files on the file system using FileSystemStorage
You have a Plone site, but you deal with large files such as documents that are +100MB or hundreds of images and you don’t want to store them in the ZODB.
Tagging your content using custom content types
Tagging is a nice way of connecting content within your Plone site (and outside of your Plone site too). Here's how to add this functionality to your own content-types and place the associated field in their main edit page.

Archetypes: Creating and Extending Content Types: Code Generation with UML

Plone Developer Cheatsheet
A single list of every technology you need to learn, in the order you need to learn them.
ArchGenXML 1.x- Getting started
ArchGenXML is a code-generator for CMF/Plone applications (Products) based on the Archetypes framework. It parses UML models in XMI-Format (.xmi, .zargo, .zuml), created with applications such as ArgoUML, Poseidon or ObjectDomain. This tutorial will help you get started developing applications with the aid of ArchGenXML. Please note ArchGenXML 1.x is not supported any longer and should be used only to maintain existing projects. If you're starting a new project, use ArchGenXML 2 instead.
ArgoUML and the Way of the Folder
Creating a content type, its folder, new roles and associated workflow the ArchGenXml way. Includes a recipe, setting up the toolchain, concepts and an example
Building Custom Content Types with ArgoUML and ArchGenXML and Permitting Anonymous Content Submission
And howto on creating a custom content type with ArgoUML and ArchGenXML, and allowing anonymous submission of that content.
Creating an new content type using ArchGenXML
This how-to explains how is possible to create news content-types using uml diagrams.
How to subclass an ATContentType in 7 Minutes
Learn how to subclass an ATContentTypes type (types used in Plone 2.1, like Page, Image, etc.) using UML and ArchGenXML. In this how-to we're creating an ATDocument derivate where content itself is a page template.
Using ArgoUML with ArchGenXML
Using ArgoUML and ArchGenXML to subclass PloneArticle and customize your workflows.

Archetypes: Widgets and Fields

Plone Developer Cheatsheet
A single list of every technology you need to learn, in the order you need to learn them.
Adjusting Kupu edit area size
Kupu (Visual Editor) edit area size might be too big for pages containing several short rich text fields. This how to explains how to adjust the size per field.
Creating custom Archetypes fields and widgets
Archetypes includes many kinds of fields and widgets, but sometimes it's necessary to create your own. In this tutorial you will learn how to create custom fields and widgets and how you can distribute them as a stand-alone product.
Design a user-friendly form to update multiple ReferenceFields
The end result of this how-to is a design pattern for making a customized widget to wrangle an array of AT Reference Fields. The true purpose of the how-to is to document one process for semi-technical Plone developers to move from problem to solution.
Set the default of a DateTime Field to the current date/time
It seems like a simple task to set the default date/time when the user creates a new instance of your archetype Object. And it is -- but it took me awhile to find the answer. Maybe this will save some else some search time.
Using multiple rich text fields in a custom AT content type
This howto explains how to find the format of a specific rich text field in a custom AT content type. If you have more than one field, the standard way of doing this (which is based on the rich text field being the «primary» field) doesn't work. The howto also explains how to set the default output type of a rich text field.

Other

Introduction to the ZODB
An overview of the ZODB, Transactions and ZEO. Delivered at the Plone Conference 2007, Naples.
Plone Developer Cheatsheet
A single list of every technology you need to learn, in the order you need to learn them.
Add Configlets for own Product's settings
If you write your own product with "configlets" to configure product-specific settings, here's how to install these configlets so that they appear in the Plone control panel.
Add indexing attributes to arbitrary content types
How to invoke the shadowy and mysterious ExtensibleIndexableObjectWrapper to do something totally useless.
Adding configuration settings using Zope 3 schemas and formlib
This how-to explains how to add a configlet to Plone's control panel and letting the Zope 3 framework do the work for you.
Adding new roles to the Sharing Page
Explains how to add other roles to the set of managed roles at Plone 3 sharing tab.
Catalog anything in Zope/Plone
This how-to shows how to catalog non-object data in the catalog, and search for them. Useful when you've a list of items you wish to use like an sql table.
Create a Custom Tool
How to create and install your custom tool.
Create a product to import existing photos as external resources
Import existing photo album as external resources by creating a ExPhotoAlbum product
Create and Use an External Method
Zope External Methods allow you to write and register python scripts that can be called through-the-web to manipulate your Zope/Plone instance. The main difference is that these can do things with a much higher privilege level since they are located on the file system, not in the web interface.
Creating Content Rule Conditions and Actions
This tutorial shows how to create a new type of condition that site administrators can use to construct Content Rules in Plone 3.
How to Embed ViewCVS in Plone
An example of how to 'persuade' ViewCVS to embed in a Plone page. Provides an account of how to do rewriting with Apache, converting ViewCVS, and adding externally created, dynamic content to Plone pages.
Improving accessibility for your Plone sites
The present document does not try to summarize the WCAG (Web Content Accessibility Guidelines) but to emphasize the aspects that are often forgotten.
Integrating CMFFormController with Formulator
This howto explains how to use the CMFFormController infrastructure with Formulator-created forms.
Migrate Custom AT Types with Products.contentmigration
How to migrate the custom archetype types that you have created using Products.contentmigration. Appropriate for changing field names, package names, or types from one to another.
Over-riding a Page Template in a Skin
How-to override a product's page template in your own skin making sure it is applied before the original template
Profiling Plone and tuning add on product performance
This document will tell how to profile Plone. Profiling is an action to find out bottlenecks to improve the performance of code. The primary audience of this document is add-on product developers who want to make their products scale better.
Simple PlonePAS Example
In this tutorial you will build a simple authentication plugin using PlonePAS. There are a couple documents that provide various details for writing PlonePAS plugins but nothing that covered all of the things I had to do in order to get something working. This tutorial will hopefully accomplish that.
Using jquery to write dependent comboboxes
A simple and ready to go example of dependent comboboxes using jQuery.
Using Macros and METAL in Plone Page Templates
An overview of how Macros and METAL tags are used in Plone. The aim is to give new users a basic understanding by going over some examples of macros and METAL in action.

Overview

Customization for developers
This tutorial provides an overview of how to customise different aspects of Plone 3
Best Practices for Plone development
Based on the talk given by Joel Burton at the Plone Conference in Vienna, this Tutorial discusses some of the best practices for Plone development. If you are doing site development with Plone and want to keep your sanity, this is a must-read. Requires some familiarity with Zope and Plone.
Beyond the Books: Learning Plone For Yourself
This how-to provides some helpful suggestions on how to get beyond book learning and start acting like a Plone-Fu master.
Common Plone programming recipes
Please see notes for new documentation.
Plone CMF ZOPE - What supports what?
This is a first attempt at creating an overview of which part (Plone/CMF/ZOPE) implements which functionality of Plone 3.0
Plone page request processing walkthrough
UML sequence diagram showing what happens between incoming HTTP request and outgoing HTTP response.

Tools and Processes

Testing in Plone
This tutorial will explain how to write safer, better code that makes you look more professional. That's right - it's time to write tests, for everything you do. Don't worry, it's not boring or complicated, you just need to learn how.
Choose the right paster template
Review the default output from "paster create" to determine which template you need.
Coping with a Live Spinning Zope
Most people who have been working with Zope and Plone for some time have learned, on one day or another, what it means for Zope to "spin". It incessantly uses 100% cpu, or very close, and, though it accepts HTTP connections, it never responds, requiring a restart. If your live Zope is spinning, you are most assuredly not having a good day, but there are some measures you can take to ease your pain.
Debug anywhere
A simple way to get a PDB session on any location
Debug Products With Boa Constructor
Boa Constructor is a free IDE for developing Python applications. This document shows how you can hook Boa Constructor up to Plone for debugging.
Debug Script (Python) with pdb
Enable pdb.set_trace() in restricted code with this Product.
Debugging .py and .cpy scripts
Knowing what goes wrong in .py and .cpy scripts
Debugging Unauthorized / Insufficient Privileges
One of the most common errors you will get as a Plone developer is the "Insufficient Privileges" message. This message does not tell you exactly what went wrong for security reasons, but there are ways to expose this using VerboseSecurity.
Debugging with pdb (the python debugger)
A brief overview of how to use the python interactive debugger within the Zope/Plone environment.
Debugging ZODB Bloat
Your Data.fs is growing at an alarming rate, but what's the cause? Digging into the ZODB could help find the cause.
Developing Plone with Eclipse
This tutorial gives a comprehensive view and advanced tips how to set-up Eclipse and utilize advanced functionality to gain ultimate Plone development productivity with IDE.
How to create a Sphinx based documentation for your project
This how-to explains how to set up and create a Sphinx-based documentation for your you add-on product and upload it to packages.python.org.
How to Quickly Search Zope/Plone Code using Glimpse
Quickly search the entire Zope, CMF, Plone source from the command line using full-text indexer glimpse.
Importing your product into the Collective
There are two strategies for introducing a new product in the Plone Collective when you already have it in your own repository: a simple svn export or a dump file that is loaded by the plone.org admins. This tutorial explains the differences and shows how to do both.
Install and setup ipython for zope
ipython is a powerful interactive shell. You can use it with a zope/plone instance for debugging or introspection.
Listing Your Project in Plone Software Center
Plone Software Center allows you to list your product on plone.org, show releases, manage your documentation, handle improvement plans, and more--all without forcing you into any particular development process or repository. We intend for this to become the canonical repository for Plone products. This tutorial walks through the benefits of PSC and demonstrates how to make the most of it.
Manually Removing Local Persistent Utilities
This document explains how you can manually remove local persistent utilities that were not properly removed from a product while uninstalling.
OCR in Plone using Tesseract OCR
This tutorial will show you how to add the ability to OCR documents in Plone using Tesseract OCR. An "OCR Document" action will be added to appropriate files and when the user chooses this action a text file with the OCR results will be added to the container.
OCR in Plone using Tesseract OCR
This document will show you how to add the ability to OCR documents in Plone using Tesseract OCR. An "OCR Document" action will be added to appropriate files and when the user chooses this action a text file with the OCR results will be added to the container.
Plone development with Wing IDE
The Wing IDE python development environment is a powerful tool. This how-to shows you how to debug you Plone/Zope2 code, including unittesting and live HTTP requests.
Query portal_catalog for Interfaces
Query the portal catalog tool for objects implementing a given interface.
SVN repository Import for Unix users
A quick, step by step guide on importing a new product into the Plone SVN Collective repository.
Unit test for CMFFormController validator
How to write a unit test for a CMFFormController validate script
View an object's catalog information
This little utility is really useful to me. I'm not sure it's posted elsewhere, it comes from Joel Burton originally. Inspect any content on your site (including folders) by appending /getCatInfo to the URL.

Tools and Processes: Debugging

Coping with a Live Spinning Zope
Most people who have been working with Zope and Plone for some time have learned, on one day or another, what it means for Zope to "spin". It incessantly uses 100% cpu, or very close, and, though it accepts HTTP connections, it never responds, requiring a restart. If your live Zope is spinning, you are most assuredly not having a good day, but there are some measures you can take to ease your pain.
Debug anywhere
A simple way to get a PDB session on any location
Debug Products With Boa Constructor
Boa Constructor is a free IDE for developing Python applications. This document shows how you can hook Boa Constructor up to Plone for debugging.
Debug Script (Python) with pdb
Enable pdb.set_trace() in restricted code with this Product.
Debugging .py and .cpy scripts
Knowing what goes wrong in .py and .cpy scripts
Debugging permissions (a real-life example)
Follow a programmer through the process of debugging an actual permission-related problem. (Published without review. I'll change it, I promise!)
Debugging tips and tricks (a real-life example)
Follow a programmer through the process of debugging a real-life bug. Watch and learn how to use a few of the tips and tricks, in the context of a full solution.
Debugging Unauthorized / Insufficient Privileges
One of the most common errors you will get as a Plone developer is the "Insufficient Privileges" message. This message does not tell you exactly what went wrong for security reasons, but there are ways to expose this using VerboseSecurity.
Debugging with pdb (the python debugger)
A brief overview of how to use the python interactive debugger within the Zope/Plone environment.
Debugging ZODB Bloat
Your Data.fs is growing at an alarming rate, but what's the cause? Digging into the ZODB could help find the cause.
Developing and Debugging Plone Products with PIDA
Basic instructions on using the PIDA integrated development framework to develop and debug Plone (and Zope) products
Developing Plone with Eclipse
This tutorial gives a comprehensive view and advanced tips how to set-up Eclipse and utilize advanced functionality to gain ultimate Plone development productivity with IDE.
Fixing Workflow States (a real-life example)
When workflows get confused, content items get reset to the default state. If you have a backup or a QA server, you can restore the correct workflow states.
Install and setup ipython for zope
ipython is a powerful interactive shell. You can use it with a zope/plone instance for debugging or introspection.
Start pdb directly from Clouseau
A recipe for starting a console debugging session from Clouseau. Allows exploration of program logic without having to set trace points in Python code.
Use gdb to get backtraces of hung/spinning sites
Sometimes code in a Plone site spins and eats CPU, or hangs, and you really need to get a backtrace...
View an object's catalog information
This little utility is really useful to me. I'm not sure it's posted elsewhere, it comes from Joel Burton originally. Inspect any content on your site (including folders) by appending /getCatInfo to the URL.

Tools and Processes: Releasing

How to upload your package to Plone.org
This tutorial explains how to distribute your packages to Plone.org using the standard Distutils commands.
Listing Your Project in Plone Software Center
Plone Software Center allows you to list your product on plone.org, show releases, manage your documentation, handle improvement plans, and more--all without forcing you into any particular development process or repository. We intend for this to become the canonical repository for Plone products. This tutorial walks through the benefits of PSC and demonstrates how to make the most of it.

Tools and Processes: Testing

Testing in Plone
This tutorial will explain how to write safer, better code that makes you look more professional. That's right - it's time to write tests, for everything you do. Don't worry, it's not boring or complicated, you just need to learn how.
Unit test for CMFFormController validator
How to write a unit test for a CMFFormController validate script

Writing Installation Scripts

Add indexing attributes to arbitrary content types
How to invoke the shadowy and mysterious ExtensibleIndexableObjectWrapper to do something totally useless.
Installation script snippets
Quick code snippets to use in quick installer installation scripts.
Understanding and Using GenericSetup in Plone
A detailed look at GenericSetup, wherein we will learn what it is and how it can be used within Plone.
Uninstall with GenericSetup
How to remove configuration profiles with Generic Setup
Version numbers in CMFQuickInstaller
Version and installation profile numbering for Plone add-ons has been changing.

Zope 3 Approaches

Plone Developer Cheatsheet
A single list of every technology you need to learn, in the order you need to learn them.
Applying a custom view to a specific folder
How to create a one-off view for a particular folder in your site.
Benefit NOW from using GenericSetup and Zope 3 technologies
Impress your colleagues by using GenericSetup and Zope 3 views efficiently and with minimal effort! This tutorial shows you how to add a new view, how to use it, how to add a new content type and how to hook it all up.
Creating SQL content types with collective.tin
collective.tin is a library for creating RDBMS backed content types on top of SQLAlchemy. collective.lead is used for transaction integration. collective.mercury supports the autogeneration of interfaces, model and db files by introspecting the RDBMS schema. This approach does not require zodb stubs. Versioning is optional. Workflow status and history (if required) are stored in the database. (This tutorial is very much a work in progress, but I figured it may be useful to make it public now)
Embrace and Extend Existing Products: The Zope 3 Way
With Zope 3 techniques (also available in Zope 2) you can cleanly extend an existing product without changing any of its code directly. In this tutorial we add annotations to a content type based on keywords. The use case we have is: extending Quills. The code is in the keywordadapter product in the collective.
Enable editing for anonymous users under certain conditions
Sometimes due to convenience it is necessary allow content editing for anonymous users. One use case is allow anonymous review and feedback in certain workflow states. This how to explains how this can be achieved.
How to make forms for Plone 3 the easy way
How to use z3c.form in Plone to create easy and flexible forms. Forget about complicated ways of making forms!
Setting Up a Subscriber in Five
Gives a step-by-step description of how to set up a simple event-driven "listener" or "subscriber" using Five. After you have seen a concrete example, all that talk of adapters and components and whatnot may seem a little less daunting.
SQL backed content types
This document gives an example of creating a content type with data stored in an RDBMS (PostgreSQL).
Using z3c.form forms in Plone
z3c.form is an advanced form and widget framework for Zope and Plone. It provides an easy and flexible way to display forms, to handle form creation, validation, and actions.
Using zope.formlib With Plone
Display the use of the Zope 3 technology, zope.formlib, in a Plone based environment. A side goal is to help demonstrate some new practices with building new Plone based applications.
Walking through Five to Zope 3
In this tutorial we start you on your journey to the powerful Zope 3 Component Architecture (CA) by way of Five. You will learn about defining and configuring interfaces and adapters, and the CA programming model. You will also learn how to use our new TreeWalker, that helps you easily define recursive operations on object trees.

Zope 3 Approaches: Five

Plone Developer Cheatsheet
A single list of every technology you need to learn, in the order you need to learn them.
Setting Up a Subscriber in Five
Gives a step-by-step description of how to set up a simple event-driven "listener" or "subscriber" using Five. After you have seen a concrete example, all that talk of adapters and components and whatnot may seem a little less daunting.