Re: [Paste] WebOb is amazing

Top Page
Author: Ian Bicking
Date:  
To: Alberto Valverde
CC: paste-users
Subject: Re: [Paste] WebOb is amazing
Alberto Valverde wrote:
> Hi,
>
> Just wanted to quickly say thanks for WebOb. I've just rewritten a
> filtering WSGI middleware using it and it went from 33 complicated lines
> to just 9 which are as self-explanatory as can be, here's the diff:
> http://toscawidgets.org/trac/tw/changeset/320%3Ace66a967df54
>
> I think this says a lot about WebOb. It is definitely going in the right
> direction.


Thanks!

BTW, you should be able to just do:

   response.unicode_body = inject_resources(response.unicode_body)

and webob should handle the encoding/decoding for you. Though this
doesn't really handle the case of no explicit encoding :( -- I've
thought about putting encoding detection into WebOb for this purpose
(using http://chardet.feedparser.org/)... though I'm not sure if <meta
http-equiv="content-type"> is handled by chardet, or not... in which
case maybe a shortcut should be provided for just that case.

Anyway, you don't have to grep for the charset yourself,
response.charset does that for you.

-- 
Ian Bicking : ianb@??? : http://blog.ianbicking.org

_______________________________________________
Paste-users mailing list
Paste-users@???
http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users