Hi Folks

I am answering my own question.

Missing:
from webob import Request

Probably some change in pylons source.

Cheers!

Mario
macm


2010/9/29 Mario Moura <[email protected]>:
> Hi Folks
>
> I have a lot of WSGI but now a lot of them are broken when I tried
> upgrade to 1.0.
>
> This class help me understand how WSGI pylons works.
>
> class StripHtmlCommentsMiddleware:
>    """
>    Strips all html comments from response content.
>    """
>    def __init__(self, app):
>        self.app = app
>        self.htmlcomments = re.compile('\<![
> \r\n\t]*(--([^\-]|[\r\n]|-[^\-])*--[ \r\n\t]*)\>')
>
>    def __call__(self, environ, start_response):
>        req = Request(environ)
>        rsp = req.get_response(self.app)
>        if "text/html" == rsp.content_type:
>            new_content = self.htmlcomments.sub('', rsp.unicode_body)
>            stripOutput = ' '.join(new_content.split())
>            if req.charset == None:
>                rsp.charset = 'utf8'
>            rsp.content_type = 'text/html'
>            rsp.unicode_body = stripOutput
>        return rsp(environ, start_response)
>
> Who can help me re-write this class to 1.0?
>
> Regards
>
> macm
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to