Kurt McKee

lessons learned in production

Archive

Hey there! This article was written in 2009.

It might not have aged well for any number of reasons, so keep that in mind when reading (or clicking outgoing links!).

Patching rawdog's rss.py plugin

Posted 17 October 2009 in programming

After previously noting that listparser chokes on invalid XML (as it should , but eventually won't ), I've taken it upon myself to patch the software that was creating invalid XML in the first place. I found that Planet KDE's FOAF blogroll was being created by a plugin for rawdog.

I wrote to both the plugin author and the rawdog author and got the go-ahead to update the plugin, so I downloaded the latest version of the plugin and set about creating unit tests. Right off the bat I discovered a bug in rawdog: it was reading -- but ignoring -- my custom configuration files! The solution is to add a single line near the bottom of rawdoglib/rawdog.py:

  elif o in ("-c", "--config"):
      try:
          config.load(a)
      except ConfigError, err:
          print >>sys.stderr, "In " + a + ":"
          print >>sys.stderr, err
          return 1
+     rawdog.sync_from_config(config)

With that fixed, I don't think it'll be long before the plugin will be outputting valid FOAF and OPML files.

☕ Like my work? I accept tips!