Tiberiu Ichim: Kotti CMS 101

published Oct 14, 2015

Talk by Tiberiu Ichim at the Plone Conference 2015 in Bucharest.

I am Tiberiu Ichim from Rumania. I have 12+ years experience with Plone and 2+ years with Kotti. I started small projects with Kotti. I am going to show some of my experience with it. How can you use it, benefit from it? When should you favor it over Plone or some other solution?

Kotti was started in 2011 at a Plone conference. The developers have Plone as common history, so Kotti will show this heritage inside of it. You will see familiar concepts, even though the platform is completely different. It is already stable for many years, you can just use it.

License: BSD. About 9,000 downloads per month, so still small, but an active, healthy and welcoming community.

Kotti: fast, light, flexible, well tested. That is its philosophy.

Create an add-on for Kotti:

$ bin/pip install Kotti
$ bin/pcreate -s kotti kotti_myaddon
$ cd kotti_myaddon
$ ../bin/pserve development.ini

This scaffold of a new add-on is tested in the core Kotti tests, so you know it will create a correct add-on.

The Node base class gives you traversal, as you are used to in Plone. It uses the adjacency list pattern, with parent and children. From a single root Node you can traverse a node tree. Access children with the dictionary protocol.

Class hierarchy is broken up among dependent tables. Each content class has its own SQL table. Transactions work, so changes are rolled back when a transaction is aborted on an error.

View definitions are done with a decorator.

You can use Zope page templates, specifically Chameleon. In a template you can use api.render_template('kotti:templates/views/tags.pt') to render a template.

deform and colander are used for schema definitions and form validation. Standard add and edit forms are just a few lines to define.

Configuration is done with .ini files. Kotti is a WSGI app.

Choices made by Kotti:

  • Pyramid as framework.
  • SQLAlchemy as most advanced object relational mapper for Python.
  • Bootstrap css.
  • Colander and deform (version 2) for forms.
  • repoze.workflow, very similar to DCWorkflow
  • filedepot for blob storage. You can store them on custom backends: file system, Amazon S3, GridFS, roll your own. It integrates nicely with SQLAlchemy and is transaction aware.
  • Bleach, Babel, Alembic, py.test, jquery, etc.

95 percent test coverage of python code, using py.test.

You can use a lot of other pyramid extensions.

It is an alternative for Plone, Django, SubstanceD:

  • Plone has a lot more features, many add-ons, TTW development. Heavy on resources, lot of features that you may not need for your site, hard to understand and get into development for newcomers. Many competing technologies: Dexterity / Archetypes, Zope2 / ZCA / Grok, Diazo / browser views / portal_view_customizations / portal_skins, z3c.form / CMFFormController / zope.formlib / plone.autoform / Archetypes. Plone is of course a source of inspiration for Kotti. Kotti is similar to core CMF in scope. With Kotti you have only one global site, instead of possibly multiple sites in one application, so Kotti has no local settings stored in the database, no need for GenericSetup, no need for most portal utilities. Also no need for the portal_catalog, as you can search with SQLAlchemy.
  • Django has many add-ons, large community. Also opinionated. Not quite a CMS. Weird for a Zope or Plone developer, especially looking at templates and the ORM.
  • SubstanceD: very good pedigree. Made by Pyramid developers. Similar features on the surfaces. Uses the ZODB instead of SQLAlchemy.

Kotti avoids burnout:

  • smaller development stack
  • starts faster
  • faster test runs
  • no lengthy builds

If you already know Kotti, it is easier to dive into Plone, compared to starting with Plone first.

If you are a Plone developer: yes, you can use the ZCA and write zcml. There is no undo or versioning yet. Smaller number of extensions, less builtin features. Not tweakable by editors, no TTW development, composable layouts, portlet management. But you could create it.

In the future, Kotti wants to say "lean and mean in all the right ways." Keep the base package light, suitable for everyone. Python 3 support is almost done. Probably undo and versioning using sqlalchemy-continuum. A REST api partially implementing JSONAPI.

See http://kotti.pylonsproject.org and https://github.com/Kotti/kotti and #kotti and the freenode irc channel.