• Current Best Practices

last modified February 12 by pigeonflight

­A single list of every technology you need to learn to develop with plone3, why you need it and how to learn it. Just whats current best practice.

Maintaining older code then see Obsolete Practices.

Feeling  brave? see Upcoming Practices. 

Confused? Read How to use the cheatsheet .

Warning: This document isn't complete. If you know plone then join and edit this page. Let's make plone dev simple. 

Deployment and Developer Environment


Buildout

For: Best way to install and configure zope and plone

How: Managing projects with Buildout,  Creating a buildout for your project

Load Balancing: Varnish + Haproxy + ZEO + Supervisord

For: high traffic sites. large numbers of custom papers simultaneous logins. processor intensive sites.

How:  Uberbuildout

Reverse Proxy: cachefu + varnish + buildout

For: Optimise cache settings for performance. Create a production environment.

How: plone.recipe.varnish 

Managing Python Modules with Eggs

For: To add new python modules that can be used by Plone and Plone related add-ons essay services. Modern python packages are distributed in a format called eggs.

How: easy_install

Paster + Zopeskel

For: Generating boilerplate code for add-ons and Plone themes

How: Readme, Create new eggs and packages quickly with paster

generic_setup profiles

For: To configure your plone instance when installing your egg

How:Understanding and Using GenericSetup in Plone, The Generic Setup Tool

Unit Testing

For: To test your code without starting zope

How: Unit testing Plone

PDB

For: Best practice when you need find out exactly how the your code, plone code or 3rd party code is running.

How: PDB and plone

Sharing your code using eggs

For:  distributing your code to shared repositories

How: jarn.mkrelease

Basics of Python, Zope, Zope3 and Plone


Python

For: pretty much everything

How: QuickRef BeginnersGuide Python List Comprehension. Python Lambda. Python decorators. Python dir(). Python help(). Debugging with PDB.

Interfaces

For: A way of assigning behaviour to an object, the simplest application is if you want to "tag" an object as being of a certain type.

How: Interfaces and why they matterWhy is my new viewlet showing up in other skins on other plone instances?
Example Usage:
Adapters, Applying a custom view to a specific folder

Components

For: Discrete collections of code that work together to perform a distinct function (e.g. A portlet, A viewlet, A view, A resource etc...). They usually have specific permissions associated with them.
How: A component is most commonly defined with ZCML, Component Wiring and ZCML, Viewlets,Portlets and Other Components, Anatomy of a Portlet,  Making Components Theme Specific

Configuration using ZCML

For: Defining and manipulating components

How: Component Wiring and ZCML,Creating a minimalistic Zope 3 View

Zope3 Adapters

For: adapters mediate between abstract APIs and concrete objects

How:Adapters , Five Tutorial: step 5  Slides

ZODB and pickling

For: Building utilities, content types or other kinds of persistance resume writers. Understanding differences to RDBMs architecture

How: ZODB/ZEO Programming Guide

portal_catalog

For: Creating custom searches of content. Indexing addition fields

How:Portal Catalog Queries

Zope Security

For: security checking, creating new permissions

How: Zope Book: Users and security

Object Publishing + Acquisition

For: Url traversal, request marshaling. How urls connect to your code

How: Object Traversal reference Martin on MVC in Zope/Plone

BrowserView Class

For: Where your controller code goes. In MVC terms, View = template (normally zpt), Controller is the BrowserView class, which gets linked to urls via zcml. A typical call would be: URL traversal -> BrowserView -> Template -> BrowserViewClass -> Model (AT class or sql or whatever).

Replaces: FormController (.cpy), python scripts, controller methods in AT classes, controller methods in templates.

How: Tutorial


Customisation

Zope Page Templates (ZPT)

For: Customize viewlets, forms, portlets

How: Reference

CSS

For: To theme a plone site

How: Elemental reference

PyPI and PSC

For: where to get add ons for plone

How:

plone.browserlayer

For: Lets views be specific just to the installed product

How:  Browser layers

archetypes.schemaextender

For: Add fields or metadata to existing content types

How: archetypes.schemaextender

Register Indexes with the Catalog

For: adding custom indexes to the portal_catalog or other zcatalog

How: plone.indexer

Viewlet

For:To customise certain areas of a plone page such as the page header. Components that can be embedded into a page template, they are associated with Viewlet Managers. 

How: Anatomy of a Viewlet

Viewlet Manager

For: A special "block" within a page template that can hold a Viewlet.

How: Creating a New Viewlet Manager, Anatomy of a Viewlet Manager

Actions (and the actions tool)

For: Add links that appear on most pages

How: Document Actions (actions.xml)

@@manage-viewlets + GS export + paster plone3_theme + skins + css

For: best current solution for a plone theming process. Skins should be used for js, css and images.

How:Tutorial  best practices for OOTB themeing

PloneFormGen

For: Create a dynamic Standalone Form . ie Fields can be changed TTW.

How: Simple SQL CRUD With PloneFormGen, Tutorial: Creating Online Forms with PloneFormGen

Remember + Membrane

 For: Create users that can be managed using workflows, make it easy to customize the registration form, improve "searchability" of members

How: Third Party Product Integration: Remember


Application/Add-on Development


Archetypes + paster create -t archetype

For: Creating new content type . Creating forms with values that persist like a database. 

How: archetypes quickref | archetypes using paster | Zopeskel contenttypes

HTML Forms + Argument Marshaling

For: Creating either a very simple or highly customised Standalone Form  

How: Object Publising reference

zc.formlib

For: Create a Standalone Form with auto generated widgets

How: Readme

Upcoming: z3c.form but not used enough yet

Zope3 Utilities + local utilities + componentregistry.xml

For: Holding singleton/global persistent data  o global methods. replaces portal_properties and plone tools.

How: martins book has the only decent local utility tuturial I can find.  mrtopf:zope3-utilities

Configlets

For: Forms that go in site setup

How: Add Configlets for own Product's settings, How To Register Configlets

Portlets and Portlet Managers

For: Creating your own portlet type or extending an existing one.

How: Manage portlet assignments with GenericSetup, Creating a New Portlet Manager, Adding Portlet Managers

Portal status message

For: displaying feedback on actions to the user

How: PLIP


­