Common Plone programming recipes
This Tutorial applies to:
Plone 2.5.x, Plone 2.1.x
This Tutorial is intended for:
Developers
miohtama
All content on one page (useful for printing, presentation mode etc.)
- Introduction Foreword for the text
- Creating and cloning items This part tells how to put in some data to your portal
- Reading and writing field values How to access and change the state of your content
- 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
- Deleting and renaming content objects Deleting and renaming Plone objects programmatically
- Security model This chapter takes an overview for Zope security model and how one sets permission barries in Python code
- Permissions How to manipulate Zope permission in Python code
- Roles Creating roles, dealing with content objects and roles
- Users Getting logged in user, manipulating user database
- Workflows How to deal with worklows programmatically
- Important content methods Getting content type, URL, workflow state, etc.
- Creating content types How to create your custom content types for Plone
- 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.
- Page template and widget magic How to perform often requested tricks with Archetypes widgets and page templates
- 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.
- Developer scripts Command line scripts which are useful in product development
- Portal catalog queries Portal catalog provides search indexing information for Plone site. Portal catalog queries are much faster than walking through objects manually,
- 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.
- Properties Properties are flexible key-value pairs assigned to content types and tools. Properties are passed to child content objects via acquisition.
- Portlets How to deal with portlets
- 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.
Reindexing and Local Roles
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
Find out if the member has a certain role: member.has_role(Manager)
Very Useful Tutorial
Thanks!
An error in "Get member email address"
The last line of the code should be:
member.getProperty('email')
Useful links for additional information
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