You don't have to -- most browsers assume text/html unless explicitly
set (others will try to "sniff" it out).  That said, it's probably
safer to add it to ensure that an old browser doesn't show text/plain.

Cheers,
Justin

On Jun 21, 4:02 pm, SeC <[email protected]> wrote:
> I'm using mako as templating engine, so it means I have to set Content-
> Type myself?
>
> On 17 Cze, 19:26, justin davis <[email protected]> wrote:
>
> > webpy doesn't set that header unless you're using a template.  You
> > could be serving images via webpy, for example, and the type would be
> > incorrect.  With templates, it guesses based on their extension:
>
> >     CONTENT_TYPES = {
> >         '.html' : 'text/html; charset=utf-8',
> >         '.xhtml' : 'application/xhtml+xml; charset=utf-8',
> >         '.txt' : 'text/plain',
> >     }
>
> > If you wanted to set it to text/html for all requests, check 
> > outhttp://webpy.org/cookbook/application_processors, and you can set it
> > before each request there.
>
> > Cheers,
> > Justin
>
> > On Jun 17, 6:57 am, SeC <[email protected]> wrote:
>
> > > I found out why paste.gzipper is not working :) Dunno why, but web.py
> > > isn't setting Content-type in headers, adding line:
> > > web.headers('content-type', 'text/html')
> > > solved the problem, but the question is why is isn't set by web.py?
>
> > > On Jun 17, 10:55 am, SeC <[email protected]> wrote:
>
> > > > Using code 
> > > > fromhttp://www.evanfosmark.com/2008/12/python-wsgi-middleware-for-automat...
> > > > seems to work fine.
>
> > > > On Jun 17, 10:26 am, SeC <[email protected]> wrote:
>
> > > > > Are You using web.py with fastcgi?
>
> > > > > On Jun 17, 6:52 am, justin davis <[email protected]> wrote:
>
> > > > > > Hmm, that's been working for me.  One caveat: it doesn't work with
> > > > > > the /static directory, only text returned from a GET or POST.
>
> > > > > > In a production setup, you should run static content through a
> > > > > > traditional browser (Apache, lighttpd) and let that gzip your static
> > > > > > content.
>
> > > > > > On Jun 16, 5:25 pm, SeC <[email protected]> wrote:
>
> > > > > > > Hey
> > > > > > > Anyone know to use paste.gzipper with web.py? I got something like
> > > > > > > this:
>
> > > > > > > from paste.gzipper import middleware as gzm
> > > > > > > ....
> > > > > > > app.run(gzm)
>
> > > > > > > It does work, but content is not compressed.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to