Personal tools
You are here: Home Documentation Tutorials Common Plone programming recipes
Support

Get Help

Join our chat rooms or support forums if you have more specific questions.

Plone Training
Learn how to design, build, and deploy a website in Plone through one of the numerous Plone training sessions around the world.
Find Plone training…
 
Document Actions

Common Plone programming recipes

This Tutorial applies to: Plone 2.5.x, Plone 2.1.x
This Tutorial is intended for: Developers

Basics of accessing and modifying objects programmatically using Python, Plone's programming language.

miohtama

All content on one page (useful for printing, presentation mode etc.)

  1. Introduction Foreword for the text
  2. Creating and cloning items This part tells how to put in some data to your portal
  3. Reading and writing field values How to access and change the state of your content
  4. Listing folder contents, accessing portal root and site tools How to travel around in content tree and use objects in the other parts of the site
  5. Deleting and renaming content objects Deleting and renaming Plone objects programmatically
  6. Security model This chapter takes an overview for Zope security model and how one sets permission barries in Python code
  7. Permissions How to manipulate Zope permission in Python code
  8. Roles Creating roles, dealing with content objects and roles
  9. Users Getting logged in user, manipulating user database
  10. Workflows How to deal with worklows programmatically
  11. Important content methods Getting content type, URL, workflow state, etc.
  12. Creating content types How to create your custom content types for Plone
  13. Views and templates Plone has different sets of views appearing for each content type. The basic views are "view" and "edit". This chapter tells how to add and manipulate views.
  14. Page template and widget magic How to perform often requested tricks with Archetypes widgets and page templates
  15. Quick installer snippets Each Plone product has quick installer script which prepares the portal for the product. Here are some useful snippets which you can reuse.
  16. Developer scripts Command line scripts which are useful in product development
  17. Portal catalog queries Portal catalog provides search indexing information for Plone site. Portal catalog queries are much faster than walking through objects manually,
  18. Actions for content objects Actions are state changing triggers users perform on objects. For example, edit object, copy or print are actions. This chapter describes how to add new actions and manipulate existing actions.
  19. Properties Properties are flexible key-value pairs assigned to content types and tools. Properties are passed to child content objects via acquisition.
  20. Portlets How to deal with portlets
  21. Creating a new content type 1-2-3 The check list what you need to do when you create new content types for Plone.
 

see also:

Debugging with pdb (the python debugger)
A brief overview of how to use the python interactive debugger within the Zope/Plone environment.
by Mikko Ohtamaa last modified June 21, 2007 - 00:23
Contributors: Mikko Ohtamaa
All content is copyright Plone Foundation and the individual contributors.

Useful links for additional information

Posted by Jonathan Serafini at June 16, 2006 - 10:15

A few additional examples on how to create and manipulate objects : http://www.ifpeople.net/fairsource/courses/material/apiPlone_en

Also, how-to create external methods, may be of use to some though may be out of scope for this document : http://www.zope.org/Documentation/How-To/ExternalMethods

Reindexing and Local Roles

Posted by Volker Boess at July 3, 2006 - 09:33

The hint about reindexing after calling a mutator is also very helpfull in changing local roles. When a local role is added, the permissions are not set correctly before reindexing When a local role is removed, reindexing can avoid nasty errors about missing permissions.

Is there an easy way to reindex a whole subtree or all permission settings?

Addition for section Users

Posted by Rene Pijlman at August 14, 2006 - 12:36

Find out if the member has a certain role: member.has_role(Manager)

Very Useful Tutorial

Posted by Lee Joramo at January 25, 2007 - 14:44
I just wanted to let you know, how useful I have found your Recipes. In the past several months, it seems that every other time that I search the documentation, this article comes up and has at least part of the solution for which I am looking.

Thanks!

An error in "Get member email address"

Posted by Fabrizio Reale at June 22, 2007 - 10:27
In the paragraph "Get member email address" you have been victim of a copy&paste error.
The last line of the code should be:
member.getProperty('email')

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by