Force content-type to text/plain in form's AJAX response to prevent HTML content-type
--- a/src/ztfy/myams/form.py Tue Oct 14 14:33:24 2014 +0200
+++ b/src/ztfy/myams/form.py Tue Oct 14 14:34:41 2014 +0200
@@ -315,6 +315,7 @@
if errors:
return writer.write(self.getAjaxErrors())
result = self.createAndAdd(data)
+ self.request.response.setHeader('Content-Type', 'text/plain; charset=utf-8')
return self.getSubmitOutput(writer, result)
def createAndAdd(self, data):
@@ -370,6 +371,7 @@
if errors:
return writer.write(self.getAjaxErrors())
changes = self.applyChanges(data)
+ self.request.response.setHeader('Content-Type', 'text/plain; charset=utf-8')
return self.getSubmitOutput(writer, changes)
def applyChanges(self, data):