Quantcast
Viewing latest article 6
Browse Latest Browse All 8

Content Type Mime Type – Headers for xml in Google App Engine

If you want to change the content type or mime type for your Google App Engine template:


self.response.headers['Content-Type'] = "application/xml"

Full example:


class MainPage(webapp.RequestHandler):
def get(self):
greetings_query = databasemodel.all()

template_values = {
'greetings': greetings_query
}
self.response.headers['Content-Type'] = "application/xml"
path = os.path.join(os.path.dirname(__file__), 'templates/index.xml')
self.response.out.write(template.render(path, template_values))


Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing latest article 6
Browse Latest Browse All 8

Trending Articles