[Header Picture]

# PyBloxsom Plugin: flavourswap 1.0

UPDATE:

You want to get the newer version. ¡Es no stupido!

I've just completed work on my first PyBloxsom plugin. It's what actually does the content-type thing described in my last post.

It's a simple plugin, really. It checks the browser's User-Agent string to see if it's a Gecko based browser. If it is, it swaps out the current flavour for the gecko flavour. Using config.py variables you tell it which flavour you want this swapping behavior to occur in and which flavour it should use instead.

Here's how I use it:

In my flavour directory, I have two flavours, html.flav and gecko.flav. Every template in gecko.flav is a hardlink to the corresponding files in html.flav, except for content_type.gecko. content_type.gecko is not a symlink but is instead its own file with the gecko content-type.

I then modified my story.html template to replace $flavour with html. Since I only have one flavor I use for web browsers this works for me. It's the one limitation of my script I'd like to fix, but I haven't really found a good way to do so yet. If other people start to use it and want to use multiple flavors for web browsers maybe I'll take a new look at it.

You can download the plugin and give it a shot. Leave me a comment if you experience any problems with it.

posted at: 2006 Jun 24 02:44 UTC | category: tech | (story link)


Copyright © 2006-2008 Zach White