Christopher Warner Studies and thoughts, usually in coherent fashion.

17Nov/073

Zope/Plone have changed my life

I can't stress enough how pleased I am with Zope/Plone in regards to a CMS system. If you are doing content management and are using Python then I strongly suggest you look at Zope/Plone. Python being such a strong and usable language that makes the impossible; possible and the architecture of Zope and the CMF Framework which Plone is built from makes it a CMS killer. Period. Which brings me to the reason for this entry.

Here at New York Magazine we have a fashion section. It's a mismash of Krang and other random Dreamweaver run around all over the place HTML. This is obviously no way to manage the content in this, the year, 2007. So I have begun to take on the process of breaking it down into Plone and came across the subscriber/event model system available in Zope3. It's great and here's a quick tutorial on how to use it.

A user is working with a Model Biography and the Fashion editor want's an IM when each Model Biography is created.

First we setup an interface (marker interface) for our Model Biography:
from zope.interface import Interface

class IModelBio(Interface):
""" Model Biography """

Think of the interface as documentation for the class, describing what it can and can't do. As this class doesn't have any methods there is just a comment describing that it's a Model Biography.

We then have the actual ModelBio class which implements our interface.

class ModelBio(BaseContent):

"""A Model Object """
implements(IModelBio)

From here we can now modify our configure.zcml (this configures Zope the way we want it), where we add our subscriber. Here is a good description of ZCML and why it gives our code more structure.

note: Do to the way WordPress filters html tag/close tag should be replaced with the appropriate markup. Seems I need to either upgrade or find some new blog software.

tag subscriber
for=".interfaces.IModelBio
Products.Archetypes.interfaces.IObjectInitializedEvent"
handler=".events.model_created"close tag

What this says is that for ModelBio we want to know when a ModelBio object is created. When we know that, events.model_created, will be handling said situation. So, all that's left to do is add a method called model_created in events.py

def model_created(model, event):
""" blah blah """
print model.title + " has been created"

That is pretty much it! Again, if you are doing CMS anything you may as well investigate Zope/Plone. I also highly recommend picking up a copy of Martin Aspeli's book; "Professional Plone Development", available here. It will definitely help, even if you are a beginner to Plone. Here's a recent review of the book on Slashdot. As usual the commentary on Slashdot is to be used as toilet paper. Needless to say I don't make a dime off of any of this the book is just that good.

4Oct/070

Zope and Plone

So, after weeks of investigating Zope and in more specific Plone which is built using CMF* (Content Management Framework) I was highly impressed. Then, finally being able to get some time I started converting some content from Krang into a Plone product. There have been a couple of hurdles involved; primarily in getting Zope to push out static content. It was suggested that I simply serve everything dynamically but i'm not sure that's such a good idea, considering the amount of load expected and I'm not sure how to properly construct everything yet. The second suggestion was to use Entransit or CMFDeployment. I am more fond of having the application server and the actual content completely separate. This keeps the problem domains seperate in my head. If one has to worry about the performance of having content entered on-top of having to worry about the performance of serving it. Things get alot more difficult.

Entransit seems to be the real answer but it's rather new and doesn't use Plone 3 yet which is what I started with. CMFDeployment also doesn't work with Plone 3 which means I'll either have to get that working or retard back to Plone 2.x which I'd really not rather do. Needless to say any of this is years if not decades ahead of Krang.

Filed under: Uncategorized No Comments