16 hours into a new CMS with Pyramid

January 25, 2010 | categories: Python, Web, Pyramid, Programming, Kotti | View Comments

I've started implementing a new CMS yesterday. (Note that the date of this entry is wrong, it should say 2011/01/25.)

I'm basing it on Pyramid, and it's mostly following Pyramid's default patterns (with traversal and standard security, and SQLAlchemy for persistence). At the same time it tries to be extensible in that you can add new content types and views from within your own packages.


This post is not about the details of the CMS itself. But about how much Pyramid and SQLAlchemy rock for this kind of a thing.

I'm really impressed by what I was able to do with these two tools in just two days -- and that includes time discussing and thinking about what I really want, i.e. design.

What I've implemented so far:

  • Traversal with persistent, inheritable ACLs
  • A Node class and an example Document class that inherits from it
  • Nodes are set up to use the adjacency list pattern, and every node knows about its parent.
  • Every Node is a container of other nodes.
  • Every type of Node may have their own view, which is registered like usual.
  • Nodes may have a different views on an instance basis. That is, the root document can have a different view than my personal homepage, although they're both instances of Document.
  • SQLAlchemy is set up to do polymorphic queries, that is, querying for Nodes will hand you back instances of Document if the Node happens to be a Document.
  • Plug in your own modules via the Paste Deploy INI file to extend the CMS by new content types and views.
  • Unit tests and functional tests are running.

What's missing from a minimal, working CMS:

  • View and Edit screens,
  • Theming, template inheritance story,
  • Content type factories, i.e. "which types of content may the user add in this context",
  • and probably a few more things that I forgot.

Update: Kotti's source may be found at its homepage: https://github.com/Kotti/Kotti. Kotti also has a mailing list.