Monthly Archives: July 2010

What I have learned today about custom template filters in django

If you make changes to a custom template filter, or, in some cases, even a function that passes data to a custom filter, and the filter stops working, restart your web server. That should reload the filter into the template cache. Takes me a day to realise that usually. Now I’ve written it down I shouldn’t forget. When I can find my glasses. Oh, here they are, on my face.


The joy of web – how fussy IE can be

I’m developing a small Google Maps application and have come to hand over the first cut for testing. I don’t have a Windows machine about the house at the moment so didn’t test on Internet Explorer. The map going to be mostly used on mobiles anyway. Immediately the client told me that naturally, it didn’t work on IE. I managed to confirm this using and went looking for clues as to what the problem was.

The right path seemed to be that IE8’s security features can stop maps loading. This made some sense in Microsoft World as a page that was loading mixed data from different locations is probably Up To No Good, and the solution seemed to be to tell IE8 to act like IE7 in this case, using this header:

which naturally seems like the sort of horrible cludge that we have come to know and love from a web browser that is made by wage slaves in a cubicle farm in Bangalore.

This morning I managed to test in IE using the simple expedient of switching on my partner’s laptop. It threw an actual error and a location in the javascript, which I traced to the line that handles the XML data that the Maps script takes in. It was true that there was a character error in the XML data, but the map still loaded in Firefox, Chrome and Safari. I loaded the XML script in IE and it helpfully told me where  the parser was choking. The application of assorted text lint fixed all the problems and the map now loads in IE7 and IE8 (quite possibly in IE7 emulation mode, but right now I don’t care).

The lesson learned: the world’s worst web browser can actually be quite helpful when it isn’t doing things that other web browsers do properly. Or when you’re trying to manage data without cleaning it.