I’ve been struggling with one nagging stupid little bug in my archetypes-based content types. They just wouldn’t sort in the folder contents view.
This normally wouldn’t be that big of a deal. Don’t get me wrong, I hate to have expected features not work, but it isn’t a show stopper for most apps…. Well, it wasn’t until recently, anyway :).
I decided a while back to lash out against my adventurous nature and take a firm stance of doing things The Plone WayTM as much as possible when I develop new products. I reckon Plone has figured most things out, and if I don’t like how it works, or it’s just broken, I’ll fix it.
…And the journey will make me a better person.
For reasons beyond my understanding, I’ve been working on a lot of projects lately that need ordered items within folders. As such, my new docturne, The Plone WayTM wasn’t working for me, and I really needed it to.
A couple of weeks ago I dug and dug and figured the problem was with what interfaces I was implementing. That line of thought was a complete red herring. Awesome :(.
Today I found some time to take another whack at it. I did a bunch of research and came up empty. Then I took a look at the mailing list archives for the product developers list, in preparation to post.
That’s when I found this thread: http://plone.org/support/forums/addons#nabble-td356376|a14300974. SCORE!
Turns out the ordered folder support expects content items to be registered with CMF. I’m not clear on how this happens inside of Plone, but it can be fixed by setting the
meta_type attribute in your content type class. You can just set it to whatever the
portal_type is. For all the details, see Issue #414 in Faculty Staff Directory
SO, my problem has been solved, thanks to WebLion, and diligent research!
I’ve also updated the
addcontent contenttype template in ZopeSkel’s trunk, . This should help people get this feature into their code, even though I really don’t know why it’s necessary.
Side Note: if you use a front-end to monitor the mailing lists you really should access them through GMANE, using the news reader interface. It gives you access to the entire archive, and you can easily reply or make new posts. I like better than nabble, except for linking to threads :).
Where’s Robert Stack when you need him?
When I changed ZopeSkel to reflect this issue, I got a note from Wichert Akkerman responding to the commit notice (I <3 SVN commit hooks). He told me that the
portal_type attribute was completely unnecessary. He said that GenericSetup should handle setting the portal_type attribute. I thought about it a bit I realized that that made perfect sense, and I recalled thinking it was a little weird to specify it in the code, but never questioned it, because I saw the same thing in Martin Aspeli’s Professional Plone Development (chapter 10, page 196). *shrug*.
It’s still my favorite book ever.
This wasn’t the end of it. :) See http://plone.org/support/forums/core#nabble-td2948892