I wrote the Adventures In Theming series about a month ago as I was working my way through developing my first theme product for Plone 3. Initally it was a very long single blog post, but I figured it would be more useful to people if I split it up and released it over the course of a couple of weeks.
WordPress didn’t seem to like that after the first few posts, at least in the atom feed, so I think I lost a lot of Planet Plone views. Sorry if anybody was following along. :) It looks like google is helping people find the posts, so it’s not soo bad, and anyway, I doubt anybody was waiting with bated breath for the each installment :P. It’s pretty hard to read if you just happen upon the individual articles, which sucks.
I’ve just put all of the posts into one page as promised. If you’ve done themeing, or want to do theming, please take a gander. As with anything I write, I’m always open to suggestions, corrections, etc. I got some editing help from Rob Lineberger before I broke my original post up into a series, which I think helped the series a lot (so buy him a beer and tell him to get a blog already if you see him… or ever meet him). I haven’t audited the code in a while, that’s on my todo list, but I can always use help with that. Getting to the point: be a good blogospherizan and give me some feedback :)
So anyway, enough epilouge-ing, there’s some new developments that need to be at least documented (does anyone actually read this far down into a blog post?) to help wayword googlers and stranded plonistas learn from my mistakes.
Recall my original implementation idea from my first post:
I thought that because viewlets were registered providers, I could easily get the stock plone viewlets I wanted to re-organize to show up in my new viewlet by simply using the provider prefix in TALES expressions in my page template.
It just didn’t work. I was met with weird errors, and spent a lot of time trying to work around them (I just couldn’t blame Plone, it had to me my fault)
I didn’t do much digging until after my theme was complete. I traced the problem down to the stock viewlets, but didn’t realize that the problem was actually with the stock viewlets.
I ranted a bit about the situation during a psuedo-pair programming session I was having with my coworker, Mark Biggers (who also doesn’t have a blog yet). I was putting the finishing touches on my theme product at the time, and showing Mark what I did.
I was a little peeved that something that should work, going by every book and piece of documentation I had, not to mention logic, just didn’t work. I also felt stupid because I didn’t take the time to really understand what was wrong. Instead I wasted days trying to work around it, and spent even more time implementing my own viewlet manager.
Mark agreed that the situation seemed really odd, and suggested I take a look for some known Plone bugs to see if anyone noticed the problem before. In my haste and fustration, I never thought to look into the plone trac to see if somebody had submitted a bug ticket with the same problem I had. Taking Mark’s advice, I gave it a shot, and within seconds, in the first search I did, I found a bug ticket that was precisely the problem I was having. And the person who posted the bug was dilligent (and estute!) enough to figure out how to fix the bug and submit a patch. Score!
But the celebration was short lived. Upon further inspection, I realized the ticket was marked fixed. But wait, the bug also says “milestone changed from 3.x to 4.0”. This was just confusing, so I did some digging.
I was able to verify that the bug was truely fixed (6 months prior), and that it truely wasn’t in the latest release of plone.app.layout. That made no sense to me, especially given that the change was 5 characters.
I figured this warrented a post to the plone core mailing list, just to see what the reasoning was. I didn’t really get the response I wanted.
Note to self: I need to follow up on this. If there is anything I can do to help out, I really need to put some effort into finding out how. I’m not sure how releases work in Plone, so I didn’t want to volunteer, but in retrospect I should have said “So how do I do that” instead of “can that someone be me” :P
In case it’s not obvious, this small change would have prevented the need for me to create my own viewlet manager. It’s probably best, in the long run, that I went ahead and built my own viewlet manager. I’ve learned a lot, I’ve got a more stable and flexible means of customizing Plone, and I was able to document it pretty thouroughly, which (hopefully) will help somebody (most likely myself) someday.
In spite of that most Excellent Adventure (surely not a Bogus Journey), bugs suck. When you find out that days and days of fustration could have been avoided by such a minor change, it really makes you want to do whatever you can to avoid (and fix!) bugs in general.
So since I wrote my initial post my theme has been deployed in a live site and it’s gone over well. It’s holding up to multi-browser scrutiny in a very hostile environment (research lab at a university :)).
One thing I failed to document before, however, is that this first deployment is also the first time I extended my theme. This worked surprisingly well. The only customization I’ve had to do so far is change the logo, but between skin-layer changes and zcml overrides I don’t think making major changes to the way it looks without changing the layout should be pretty easy, and I think more drastic re-arrangement wouldn’t be much harder.
So I plan to document that in a blog post in the near future.
I also want to see how well my theme plays with CSSManager, and see how I can integrate with it, or add my own tool that’s specific to my applicaitons and base theme.
One thing I didn’t do much of that I’ll need to expand on is writing my own viewlets. The theme I created will be used in conjunction with a suite of applications I’m co-developing. You may have noticed I left a large empty space in my theme on the upper left-hand side. I plan to put a context-aware viewlet there with application-specific information and links to help and common resources. It should be pretty cool, I’ll document it here on my blog when I get to writing it.