Per Erik Strandberg /cv /kurser /blog

I worked quite a bit on getting into Plone CMS (Plone Content Management System). On this page I have collected a few tutorials I wrote to better understand the system.

Plone is available from here: [1] (plone.org).

My First Minimal Plone Content Type

In My First Minimal Plone Content Type I try to extract a minimal content type. The reason for this is exteremely simple: there are a lot of documentation out there, and even more old documentation. It is hard to follow the documentation and the tutorials I have read often include more than 20 files for a small content type. I manage to make a content type in the following four files:

Out of these four files config.py contains only one row of code. Extensions/Install.py is just generic boiler plate code and does not need to be updated at all if only config.py is ok. __init__.py only needs to be updated if you change the name of the message.py-file and if so you only need to change one row of it. Last but not least there is the message.py-file of about 20 lines of code. Hopefully this is as minimal as you can get.

You can download the source code here: [2]

When you have read this tutorial you should be able to do something like this:
http://www.pererikstrandberg.se/blog/plone/mymessage_3_view.png

Modifying The Minimal Plone Content Type

In Modifying The Minimal Plone Content Type I modify the schema to make the content type contain more fields (like dates and an image). You can download the source code here: [3]

After this tutorial you should be able to make content like this:
http://www.pererikstrandberg.se/blog/plone/party_party_2.png

Plone Accessor Mutator Hints

In Plone Accessor Mutator Hints I show you some hints on how to change the accessors and mutators of a field. This means that you can display something that is derived from the value you store. You can download the source code here: [4]

In my example I store a number (like 1337) but display words instead (one three three seven) and it becomes a little something like this:
http://www.pererikstrandberg.se/blog/plone/mymessage_accessor_2_view.png

Plone Archetypes Field Validator

In Plone Archetypes Field Validator I demonstrate how you can use validators on the fields of your schema, and also how you write your own ones. This way you can verify that the values a user enters makes sense (so that an email looks like an email). As example I write a validator that makes sure that an integer value entered is a Fibonacci number. Download the most complete version here: [5]

After this tutorial you should be able to write validators that can segregate a non-fibonacci number from a fibonacci number:
http://www.pererikstrandberg.se/blog/plone/mymessage_validator_custom_2.png

Plone Archetypes View Template Modifications

The Plone Archetypes View Template Modifications tutorial is long and quite complicated. Despite that it is not in fact entirely complete - it only demonstrates how you change the view of a content type. This is possible to do in (at least) three different ways. For download links browse through the text of my Plone Archetypes View Template Modifications tutorial.

Download the three different versions here: [6], [7] and [8]

After this tutorial you should be able to create modifications of the view of a content type, a little something like this:
http://www.pererikstrandberg.se/blog/plone/mymessage_view_macro_complete.png

Plone Folderish Content Types And References

In Plone Folderish Content Types And References I explore the possibility of creating a folderish item. This is pretty much a special folder that you can customize in many ways. I use it in combinations with references between objects to create a small network class. There is not as much python code in this tutorial as I would have expected - at least not in py-files. Most of the tricks are to my surprise used in the pt-files (perhaps because I want to remain a minimalist).

Download here: [9]

After this tutorial you will be able to create your own folder type and you will know how to only allow certain content types is in. You will also know how to create and use references and back-references. My example looks a little something like this:
http://www.pererikstrandberg.se/blog/plone/plone_network_view_folderlisting_480.png

Plone Export And Document Tools

The short tutorial of Plone Export And Document Tools explains how you can export a content type to file by adding a document tool. Also this tutorial demonstrates some use of xml (and zcml) in modifying the behavior of your Plone instance. Yet another new concept I briefly touch upon is the use of less secure python code.

Download here: [10]

This is a screen shot of the form I use to export a content type in different formats.
http://www.pererikstrandberg.se/blog/plone/plone_document_action_export_form.png

Plone Customization Of Third Party Content Types

Sometimes a third party product is almost exacly what you want to use. But sometimes it has some features that you do not want and you get annoyed and do not really know how to proceed. One solution and/or best practice is to use inheritance and in Plone Customization Of Third Party Content Types I show you how you can do just that. Download here: [11]

Plone Viewlets First Contact

A first contact with Plone Viewlets: Plone Viewlets First Contact. We just add a little something to all Plone pages. [No download available.] It will look something like this:
http://www.pererikstrandberg.se/blog/plone/viewlet_part_one.png

Plone Generic Setup First Contact

A little introduction to simple use of Generic setup is found in: Plone Generic Setup First Contact. Download here: [12]
http://www.pererikstrandberg.se/blog/plone/generic_setup_diff_crop.png

Plone Title Less Content Type

In Plone Title Less Content Type I tried to follow a how-to at plone.org that was marked as outdated (find it here:
[13] ). The reason was that I wanted to be able to have make some dirty tricks when creating the title (and thus id) of an object.
http://www.pererikstrandberg.se/blog/plone/mytitleless.png

Plone Custom Widget Macro Thingie

In Plone Custom Widget Macro Thingie I modified the Macros of the Widgets of a custom Plone Archetypes Content Type. It is not pretty but it shows you how to get going. Download the base content type here [14] a modified version here: [15] and a version using widgets from ATExtensions here: [16] . In the below screenshot I have pretty much just removed the annoying br-tags of the radiobutton select widget.
http://www.pererikstrandberg.se/blog/plone/specialselection3.png

Plone Simple Folder And Permissions

In Plone Simple Folder And Permissions I try to figure out how to share a folder and allow regular users to add contents to it. The solution turned out to be ridiculously simple and could was more or less just an optional parameter that needed to be sent into a function that I had to call anyway. A product with the problem fixes is available here: [17] and the problem I had is illustrated in this screen shot:
http://www.pererikstrandberg.se/blog/plone/simplefolder3.png

Plone Content Type With Custom Workflow Via Generic Setup

In Plone Content Type With Custom Workflow Via Generic Setup we add a home made workflow to a content type with generic setup. Download it here [18] . Working in ZMI to create the workflow is part of the process - that looks a little something like this:
http://www.pererikstrandberg.se/blog/plone/workflow-1-new.png

Plone Meta Data Folder Listing Portal Catalog and Brain Proxies

In Plone Meta Data Folder Listing Portal Catalog And Brain Proxies we explore different ways of storing meta data, making indexes and take a closer look at the freakish proxy object brains. Download without generic setup here [19] and with here: [20]
http://www.pererikstrandberg.se/blog/plone/MetaBrain2.png


This page belongs in Kategori Programmering.