Archive for June, 2005

RSS incompatibility

Friday, June 3rd, 2005

Looking around on the web for a decent (i.e. formal) specification of RSS, I found this page.


It looks like not only is there no formal specification for RSS 2.0, there are in fact several indistinguishable but incompatible versions all calling themselves RSS 2.0. Sigh. How the fsck am I supposed to figure out how to make my RSS valid if there’s no formal spec for it, much less a DTD?

fixed timezone stuff (RANT WARNING)

Thursday, June 2nd, 2005

Just spent hours hacking up these scripts again to make them handle timezones properly (originally because RSS pubDate elements require an RFC (2)822 date, and mine wasn’t providing a timezone).

This was made particularly hard by

  • the lack of support in MySQL for timezones in date types (why oh why?)

  • the insistence of MySQLdb (the library I’m using to interface with MySQL) on using an undocumented date class called DateTime instead of any of the standard Python libraries (actually, it seems to be a half-arsed form of mxDateTime, with no indication as to what’s implemented – and of course having the same name (except for case) as one of the standard libraries makes it impossible to google for more info)

  • the fact that Python knows what the current timezone is, but there is no straightforward way to find it out. There is an abstract tzinfo class but no subclasses or instances are defined, and of course, though the timezone of datetime.utcnow() is always the same, neither it nor datetime.now() have tzinfo fields unless you provide them! You have to figure it out manually by rounding datetime.now() – datetime.utcnow() to the nearest hour. Fscking irritating.

Steve pointed me at help(“time”) which gives a marginally less roundabout way of doing it… but that still involves checking one variable to see which of two other variables to use for the value, which you still have to convert into a string. All I want is the +/-XXXX descriptor! You’d think there’d be a single string variable or function to do this, but nooooo…

XSLised blog is live!

Wednesday, June 1st, 2005

Yes that’s right folks, you’re now looking at a pure RSS blog! (Unless you’re watching through SUCS Planet or something.)


How is this possible? It’s all due to a very funky mechanism called Extensible Stylesheet Language Transformations (XSLT), which lets you take some arbitrary XML data and present it in some other XML form. In this case the XSL stylesheet blog.xsl just turns an RSS file into the XHTML you are looking at right now. The best bit is that this is all done by your browser, so the only script I have to maintain for the blog is the one to generate the RSS file.


Of course, your browser has to support this. The two most popular browsers in the world, MSIE and Mozilla Firefox, both do this without a hitch (though making it work in Firefox is slightly more tricky as IE ignores some details to do with XML namespaces that make Firefox forget it’s looking at XHTML). Opera, that other browser advocated by some fanatics of questionable intelligence, has no support whatsoever. Since the blog will be on SUCS Planet soon enough anyway, this shouldn’t stop you reading it.