alan little’s weblog

press release

6th October 2003 permanent link

Alan’s weblog now has an RSS feed – another triumph for the power of python and Alan’s super-sophisticated five line templating engine.

The feed looks ok in NetNewsWire Lite and has survived a pass through feedvalidator.org. If anybody has any problems with it despite this rigorous quality control process, I’d be grateful to hear about them.

And more joy of python: converting all relative links (including images) to absolute links so as to remove a potential source of confusion for newsreaders. Four lines, ten minutes:

attribsToConvert = {'a':'href', 'img':'src'}
for k in attribsToConvert.keys() :
    for e in xmlText.getElementsByTagName(k) :
        e.setAttribute(attribsToConvert[k], \
            urlparse.urljoin(baseURL, \
            e.getAttribute(attribsToConvert[k])))		
        # urljoin does nothing if the url is already absolute

related entries: Programming

all text and images © 2003–2008