On 28 Jul 2006, at 17:41, Adrian Holovaty wrote:
On 7/27/06, Doug Van Horn <[EMAIL PROTECTED]> wrote:I don't know if anyone will find this useful, but I thought I'd throw it out there. I wrote a little Middleware class to strip trailing and leading whitespace from a response:Hey Doug, Thanks for contributing this! If you could, post it to the collection of user-contributed middleware here: http://code.djangoproject.com/wiki/ContributedMiddleware
Thanks, works great, but ... :)Your process_response don't check for Content-Type so it will strip whitespace characters everywhere (i.e from images).
Add at start of process_response:if 'text/html' not in response.headers.get('Content-Type', '').lower (): return response
-- Nebojša Đorđević - nesh Studio Quattro - Niš - Serbia http://studioquattro.biz/ | http://trac.studioquattro.biz/djangoutils/ Registered Linux User 282159 [http://counter.li.org]What is the sound of one backpack EMP weapon discharging? -- Joe Thompson
"Clickety-click" -- Charles Cazabon
PGP.sig
Description: This is a digitally signed message part