Weblog

published Nov 03, 2021, last modified Nov 04, 2021

David Glick: Building Content Types with Dexterity

published Oct 29, 2009, last modified Oct 30, 2009

By David Glick, ONE/Northwest, USA

Over the past year and a half, Martin Aspeli and company have been hard at work creating Dexterity, the next-generation framework for developing content types in Plone. In this tutorial, you learn the basics of building content types with Dexterity, how it compares to Archetypes, and the current status of the project.

I am working for groundwire, formerly known as ONe/Northwest.

A content type is for example a page, document or image. It has a schema, custom view templates, miscelaneous settings (can you search for it, can you add comments, etc).

History lesson. CMF (Content Management Framework) is an underlying framework for registering types, assigning workflows. Not schema based. Archetypes came along and provided schemas, with schema based form generation. Not going away anytime soon. But it has some ugly bits. Not easy as basis for generating schemas TTW (through the web).

At the Plone Planning Summit we talked about how we were going to create content types in the future, still archetypes or not. So after that, Martin Aspeli started the Dexterity project. Make it possible to define a content type through the web, export it to the file system and be able to do this the other way around as well.

Products.Archetypes is big. plone.dexterity is small and you can extend it with just the extra parts you need.

Archetypes does a lot of what seems to be magic; a lot of code, like factories and methods, that are created on the fly.

Installing dexterity: add the plone.app.dexterity egg in your buildout.cfg and add http://good-py.appspot.com/release/dexterity/1.0a2 in your buildout extends lines.

Options for extending a content type are subclassing, archetypes.schemaextender, and now with dexterity you have a new concept called behaviors. A behavior can be something like: create the short name of the object from the title; add geolocation; add ownership.

You have to watch out when changing a content type, as existing objects are not automatically updated, for instance when you change a field name.

We don't create custom Add permissions yet through the web.

Example package: example.ploneconf09 at http://svn.plone.org/svn/plone//plone.dexterity/example.ploneconf09

The type definition can just be exported via portal_setup by exporting the types tool. We want some new UI for this. The schema will be in there, in escaped xml. You can also put this in a separate xml file, or define a zope 3 schema--use plone.directives.form for this.

Using a zope 3 schema: add five.grok as dependency and add package="." /> to your zcml. To move a field to a different fieldset, specify form.fieldset in the schema and list the fields you want to have on this tab.

With plone.directives.dexterity you can define read and write permissions.

Pieces

  • plone.dexterity: base content class
  • plone.autoform: makes it possible for a form to be composed by scheas and form hints from different sources, like base schema and behavior schema.
  • plone.schemaeditor: UI for editing zope 3 interfaces TTW. Dexterity integrates this with its types control panel
  • plone.supermodel: translates zope 3 schema into xml and the other way around. Easily extensible.
  • plone.directives.dexterity: Grok directives for custom views and content classes.
  • plone.folder: orderable Btree based folder implementation, will be used in Plone 4 as well.
  • plone.behavior: register behaviors (conditional adapters). For dexterity the condition is whether the behavior is checked in the FTI.
  • plone.rfc822: supports marshalling dexterity content into rfc822 (email) format.
  • plone.app.dexterity: pulls in everything you need. Has the standard behaviors.

Status

  • The core functionality is pretty solid.
  • Schema serialization has a few issues, but works okay.
  • Automatic form generation works fine.
  • You can assign content rules to dexterity.
  • Relations: not working between archetypes and dexterity content in the same site.
  • Widgets are not as rich as archetypes yet, but better than formlib.
  • TTW schema editing works fine, but needs more real-life use to iron out any bugs.
  • Image and file support are done via plone.namedfile and plone.formwidget.namedfile; no support for image scaling yet, unlike archetypes.
  • Text transform support via plone.app.textfield.
  • Select field support; no way to define vocabularies TTW yet.
  • Support for versioning and staging is in progress.
  • No automatic migration from archetypes to dexterity yet.
  • Multilingual: no support yet.

Second alpha release was on October 12th 2009. First beta coming soon.

Works on Plone 3. Support for Plone 4 coming soon.

Performance benchmarks are mostly better than archetypes, except the view, but I take that with a grain of salt. Loading an Add form is much faster.

Manuals here: http://plone.org/products/dexterity/documentation/manual

Get involved, code: http://code.google.com/p/dexterity/

google group: http://groups.google.com/group/dexterity-development

Dexterity objects are smaller than archetypes objects in the zodb.

See the slides.

Nate Aune: Deliverance - a compelling way to theme Plone sites

published Oct 29, 2009

By Nate Aune, Jazkarta, USA

This talk will be a case study of how we used Deliverance to streamline the process of theming a Plone site. The customer requirement was to use an existing HTML/CSS design but replace the backend CMS with Plone. We were able to complete the theming part of the project in a fraction of the time that it would have taken had we replicated the theme as a Plone product.

Deliverance moves elements from your content into place holders in the theme. And you don't even have to touch the theme to do this.

The knowledge you need for this is html, css, firebug and an editor. The web designer does not need to learn templating in yet another CMS.

Who is using deliverance?

Our customer, HaiVision, wanted to move to Plone, but use their current design, and wanted to be able change the html and css themselves, and within two weeks. Deliverance to the rescue!

Seven steps to heaven:

  1. Check out and run the Deliverance demo buildout:

    svn co http://svn.plone.org/svn/collective/deliverancedemo/trunk delidemo
    
  2. Prepare your HTML/CSS files.

  3. Stick the static files in a static folder in your buildout.

  4. Identify css selectors in the plone site. Firebug is fantastic for this, so http://www.getfirebug.com

  5. and identify the css selectors in the static theme where you want to put them.

  6. Create a rules file. Note: you must place drop rules before replace rules.

  7. Setup an apache vhost. You must add ProxyPreserveHost there.

See the slides for details once they are up.

Performance:

  • Deliverance respects caching headers.
  • Pages load fast, because javascript and images that are not used in the theme are not loaded.
  • Deliverance itself has a small memory footprint and hardly takes any server resources.

collective.dvsites: wsgi middleware that maps domains to different rules files:

[sites]
domains =
    *.mysite.com  %(here)s/mainrules.xml
    another.mysite.com  %(here)s/another.xml

Banjo: jQuery-powered rules generation front-end. Sprint this weekend? jQuery help needed, python programmers wanted, and user interface gurus please.

Thanks to: Paul Everitt, Ian Bicking, Aaron Vanderlip, Jordan Baker, Eric Steele, Fred van Dijk, Reinout van Rees.

More info: http://deliverance.openplans.org

Example buildout: the plone conference website: http://svn.plone.org/svn/collective/ploneconf/buildout/ploneconf/trunk

Sally Kleinfeldt: Plone web services

published Oct 29, 2009

By Sally Kleinfeldt and others (panel)

(I missed the first five minutes.)

Web services: SOAP, REST, microformats.

Products in Plone:

  • Soap: the CIGNEX project
  • REST: ATRest, gsxml
  • Atom: Vice
  • XML-RPC: wsapi4plone

wsapi4plone

Provide CRUD (create, read, update, delete) interface to Plone content. Future: also provide JSON-RPC.

AtomPub for Plone

The Zope 2 publisher only does HTTP GET and POST. AtomPub helps there.

Matt Hamilton: CMIS

Content Management Interoperability Services. Proposed by IBM, Microsoft, Alfresco and others. Allow people to switch between CMSs fairly easily. Get content in and out of a CMS. There are problems, like: will you be able to assign rights, get those rights out of the old and into the new system?

Should Plone support this? Should we participate in a public review process? "The system should support CMIS" might become a standard requirement in a CMS procurement process. Should we create a CMIS implementation? Should we get Plone Foundation support? If we participate, we legitimize it.

Some people describe it as SQL with bells on. SQL is almost expected as backend.

Alexander Limi: it may not be needed to completely support CMIS, as long as we have something similar that mostly solves the problem CMIS tries to solve.

True confessions

Alec Mitchell: for the website of a radio station we provide simple web services with a few simple browser views.

Calvin Hendryx-Parker: some simple Archetypes objects with fields are easy to create. The XML-RPC part of Zope is rock solid. We only had some problems with date conversions. We used RDF/XML to let the XULRunner of Firefox talk with Zope. JSON and SimpleJSON; newer Firefoxes have a very fast JSON version built-in. Also using jQuery.

Lighting Talks Wednesday

published Oct 28, 2009

Various speakers on the Plone Conference

Matt Hamilton: lightning talks are quick, mostly unrehearsed talks with or without slides, of just a few minutes.

Chris Johnsson: open source collaboration

I am not a developer, so I cannot help out with the code. But I can help in other ways. In which ways can you help? Participate! This is an exciting place. When you enter a restaurant with Plonistas here you can just feel the energy. Get to know everybody here. Find your place in the community.

How does open source collaboration work?

  • No difference between contributors and users, everyone can be a contributor. Anyone can fork a project.
  • You're dealing with volunteers. Herding cats, does not quite work, or is at least an interesting problem.
  • Doacracy over democracy. Actions matter more than opinions.
  • Community. Fun to be here. You spread the work around. Get credit by investing in the community that you are also getting value out of.

Andreas Jung: Produce and Publish Server Connector for Plone

Generating office formats, like pdf, rtf, odt, ooxml, ebooks, with web content as source. SmartPrintNG reloaded. High quality PDF generation, from a single web page, or creating a commplete book. Print on demand. Package zopyx.smartprintng.server and client. We now have a Plone Connector for this; automatic toc, language dependent hyphenation, etc.

Godefroid Chapelle: latest buildout additions

Gocept added more offline capabilities, by caching extended configurations loaded from the web. Add extends-cache and download-cache options.

I myself added a command 'bin/buildout annotate' that tells you from which buildout config file each line comes. I can use some help there, certainly for the formatting.

Matt: multilingual

LinguaPlone is good for content. Translating the interface can be tedious. The po files lack context. You can add TranslateInPlace to Firefox. This shows untranslated strings right in your web site. Lots of monkey patches, so we want to improve it. See Products.TranslateInPlace.

Stephan Altmüller: microformats

We have a StaffDirectory product and have added microformats. For Firefox 3.0 there is a plugin Operator that can read this and import this into your address book.

David Kamien: join the TagCite developer network

TagCite: build on Plone, collaborative knowledge management system. Hosted on Amazon EC2. Content library, viewer, comment system.

Maarten Kling: skin switcher

Four Digits. Web site for company, every district, local or project is a navigation root so it looks like a separate site. See http://blog.fourdigits.nl/changing-your-plone-theme-skin-based-on-the-objects-portal_type

Nate Aune: Banjo, point-and-click theming

With Deliverance. Work in progress, sneak preview. IF you have a tight deadline and already have an html design you can use banjo. The web designer does not need to learn CMS templating. Sits in your browser. jQuery-powered frontend to Deliverance rules creation.

Elizabeth Leddy: Unloading Plone: Approaching Scalability in Integrated Plone Systems

published Oct 28, 2009, last modified Oct 29, 2009

By Elizabeth Leddy, United States

While there is an abundance of documentation on ways to achieve better performance with Plone, there is nothing quite like actually doing it, especially with other system components getting in the way. This case based look at the performance and scaling of Plone as part of an integrated system will cover perceived front-end latency, system stability as related to Plone responsiveness, and how to set up a hardware forward architecture. This talk is meant for designers and integrators of large Plone installations.

Plone is slow and that is fine, we just have to deal with it. We are not Drupal. Scalability is talent plus hardware. You are going to require a lot of hardware.

Measure. If you don't know what is going on, you don't know how to act. Use tools like Munin. It records all activities on your system over time. Monit restarts your stuff when it goes down, or sends emails. Ganglia is an alternative to munin. Zope Health Watcher, has munin plugin.

Add whale watchers. Are triggered by system anomalies and collect info about the system at that time.

Shard you zeo: split it into several little zodbs with mount points; at least to this for the portal_catalog. You don't want to move a 300GB Data.fs. Tune your zodb caches. Watch out: do not copy stuff from one shard to another; you will lose stuff.

You want to use 50 percent of your system on average. That way you can add another zope instance quickly when you get a traffic hit.

2 zopes per cpu. The system is better at context switching than zope, so you probably want just one or maybe two threads per zeo client.

See if you can do some processing at another time, so not when saving an object.

Serve static content from a static web server. Apache is better at server all those icons than Zope.

Use css sprites.

Use HAProxy, it is really, really awesome! It has graceful reloads, it knows if a zeo client is ready with a previous request, you can configure a warmup time (give zope the time to startup without hammering it with requests).

When you display data from a different server (like SQL) add tal:on-error to display something else when it goes wrong.

For third party services, do socket.settimeout(2) (if using python lower than 2.6).

Restarting Zope is not a sin. Use monit to restart zope when it takes up too much memory.

A packed zodb is a happy zodb. Do it for your system, it will love you.

On backups:

  • use repozo for backing up
  • get some sweet disks to make the zodb faster
  • think about when you are going to pack your zodb, don't do it when everyone is busy using your server

Suggestions from the room: zeoraid, crickets, zenoss, munin.zope.