Quantcast
Channel: Hone Watson Bookmarks » App Engine
Viewing all articles
Browse latest Browse all 8

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

$
0
0

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))



Viewing all articles
Browse latest Browse all 8

Trending Articles