Hello,
I have found that when using Webob Request to make an internal request,
I cannot change the content type once the internal request is made.
@expose()
def simple_test(self):
#test request
from tg import response
from bq.config.middleware import my_app
from webob import Request
from bq.core import identity
# Try to route internally
r = 'http://host/data_service/dataset/10804
<http://128.111.185.26:8080/data_service/dataset/10804>' #internal webpage
req = Request.blank(r)
req.headers['Accept'] = 'text/xml'
log.debug("begin routing internally %s" % r)
resp = req.get_response(my_app)
response.headers['content-type'] = 'text/xml' #setting content type
log.info('Response HEADERS: %s'%response.headers)
return '<resource>This is a test</resource>'
I want to set the content type to 'text/xml' however the response is
returned with "text/html." When I set the content type before the
get_response request, "text/xml" is returned. Does anyone know why I can
only set the response before the Webob internal request but not after' and
if there is anyway to set parameters on the response after the request?
Thank you
- Chris
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.