Archive for November, 2007

Zope/Plone have changed my life

Saturday, November 17th, 2007

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.

The saga continues

Thursday, November 1st, 2007

So I have been working exclusively with Zope/Plone and Python lately and am actually having a great time! Programming in Python is actually fun and ideas are accessible without having to summit a mountain. After having to deal with Perl in specific it’s obvious that Perl is pretty much end of life for me personally, it never really was something I did anything in anyway with the exception of Krang. Professionally, there are many tools and software that I am likely to come across that will need hand-holding but it is not so bad.

Dealing with content management in and of itself has led me into new but familiar waters. This relates back to the social dynamic and the fact that developing software requires structure in order to reach your intended goal. There must be deadlines, freezing so on and so forth especially when you are trying to dig yourself out of a hole. In regards to the software I’ve been developing specifically at home so that my code is open and free; with my own datasets and on my own time. Must always have a Plan B. One of my coworkers is pretty smart in this regard so he’s always trying to figure out the smart way to attack a problem which leads him back to trying to understand “Why it can’t be done?” or “Why can’t we do it like this, it seems easier to me.” Little does he know the problem isn’t technical at all but a social one.

The Ubuntu-Hardened list seems to be active again. It’s a good idea using Selinux with Ubuntu instead of AppArmor but that’s the same old battle. Hopefully something good comes out of it this time. Unfortunately I am not able to offer any help this go around due to the fact that I have no time but if anyone was or is interested the list seems to be active again.

It seems every time Google developers drops some API news it becomes a big deal. Google’s OpenSocial is supposed to allow developers to tie in everyones favorite social environment into their own web applications. This should be interesting; When my boss sent me the link I vaguely remembered Mugshot and wondered if they had an API and they kind of, sort of, do; or at least this page would lead one to believe. It doesn’t seem fleshed out though; so it should be interesting to see what happens there if anything. I haven’t heard much about Mugshot myself though so I’m not sure why Redhat isn’t making it more visible.

Life is pretty good minus everything else. Went to the Photo expo got to listen to some brilliant photographers like Dave Black. This guys work is amazing and he even gave away some techniques. The best thing about the Photo Expo besides the fact that it has always been free to get an exhibit pass was the Nikon D3. This camera changes photography as we know it by being able to capture photo’s in very low light conditions. Having ISO levels up to 12800!! It’s pretty much unheard of on any camera and will allow for all whole host of new shooting. I’m about to retire my D50 and D200 and get myself a D300 before most likely making the upgrade to the D3. Obviously I’ve taken more photos myself, getting a little bit more happy with my photos every time I shoot.