Typo Flickr sidebar problems

2 comments

The recent downtime here had me stumped – the site was throwing a rather vague ‘controller stack out of kilter’ Rails error from Typo. Looking further at the Rails production.log it seems that the problem stemmed from the Flickr sidebar model. A little googl’in brought up this discussion – It seems that Typo’s default Flickr sidebar implementation is ropey at best.

If you look in /app/models/aggregations/flickr.rb you’ll see that the model relies on a string scan (regex) to match the image url from Flickr’s description field text (in their RSS feed) like so;

def image
  description.scan(/(http:\/\/(static|photos).*?\.jpg)/ ).first.first
end

So basically if Flickr change the URL they serve images from – this will break. And that was exactly the problem – Flickr’s URL was now http://farm1.static.. blah blah etc. I modified the regex a little to quickly fix it;

def image
  description.scan(/(http:\/\/(farm|static|photos).*?\.jpg)/ ).first.first
end

This was supposed to be a quick post, but I’ll go on;

Why Typo doesn’t switch to using the Flickr API – I don’t know. You could argue it is more flexible and versatile if the data source is a simple RSS feed- (no need for API keys or security issues) – But the sidebar could at least parse the xml better and avoid this scan altogether. Its got me thinking what else could be ropey in Typo…

For one, a broken sidebar takes down the entire public-facing site with this ‘controller kilter’ error – which is a bit crazy if you ask me. If I have some time I might look into helping Typo fail a bit more gracefully in the future.

December 22, 2006 13:19 by

2 comments so far

  • photo of Tom Tom Dec 22, 2006

    Hey Matt,

    Have you considered Mephisto ?

    http://mephistoblog.com/

    Tom

  • photo of matt matt Dec 27, 2006

    I might give it a go – new year and all that. On the surface it definitely looks faster – and Dan Webb approves

Leave a comment