List Info

Thread: How to set a response header based on an argument to a page




How to set a response header based on an argument to a page
user name
2006-12-16 16:05:22
Sylvain wrote:
> benchline wrote:
> > I have a need to create a page that, based on the
> > arguments passed into it, will return different
> > Content-Type headers (either text/xml or
text/html).
> 
> Well you simply set the right Content-Type within your
page handler.
> 
> For instance:
> cherrypy.response.headers['Content-Type'] = 'text/xml'

...and if you wanted to go a step further and actually use
HTTP the way it was designed, you could switch on the Accept
header insted of 'arguments'. See cherrypy.tools.accept in
3.0.


Robert Brewer
System Architect
Amor Ministries
fumanchuamor.org


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en

-~----------~----~----~----~------~----~------~--~---
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )