Rick Hurst Web Developer in Bristol, UK


Plone 2.1 comment bug

I discovered an annoying bug with plone 2.1 where when you added comments to a piece of content, they seemed to disappear, without throwing an error. It turns out they were turning up in their parent container.

It only occurred intermittently, and seemingly randomly (aren’t they simply the best type of software bug?), but I eventually realised that it started occuring where a folder was set to Allow Discussion by default, and it was occuring where a content item hadn’t previously had any discussion, therefore it was inherting the discussion properties of its parent..

Anyway, I sheepishly showed my head in the plone users IRC channel and was advised to (guess what!) upgrade to 2.1.2 to fix the problem. Got out of there sharp quick before anyone asked me to contribute anything useful.

As per usual simply upgrading to the latest version isn’t always a possibility with a live site, particularly where there are several production sites running on the same zope instance and with no hugely convenient way to create an exact replica for a test run of a migration.

So I installed a fresh instance of 2.1.2 locally (gotta love that clicky button mac osx installer – that’s my type of software installation), checked that the bug was indeed fixed in 2.1.2 and then did some digging, stepped through the code a bit and found that CMFPlone/DiscussionTool.py had changed slightly. (I’m sure I could have checked some sort of changelog or SVN repository, but without someone to spell it out to me, finding out what/where/when how to do such a thing would probably take me longer than it would to knock up my own commenting system from scratch.

So I swapped the file, refreshed CMFPlone and …Doh!!! something bad…, swapped it back, refreshed and .. Doh!!.. still bad.. panic a bit, ask around if anyone else just happened to be doing something on that zope instance that might be causing the bad stuff, but no… so restarted the zope instance and it started working again, swapped the files again, restarted and lo and behold commenting fixed.