Strip leading and trailing newlines from our responses
authorSverre Rabbelier <srabbelier@gmail.com>
Thu, 12 Mar 2009 21:38:07 +0000
changeset 1812 a0ab93cc3cd5
parent 1811 75d3c1384736
child 1813 5cc9e055a818
Strip leading and trailing newlines from our responses Without this CSV exports look funny. Patch by: Sverre Rabbelier
app/soc/views/helper/responses.py
--- a/app/soc/views/helper/responses.py	Thu Mar 12 21:37:38 2009 +0000
+++ b/app/soc/views/helper/responses.py	Thu Mar 12 21:38:07 2009 +0000
@@ -74,8 +74,10 @@
   if response_args is None:
     response_args = {}
 
-  response_args['content'] = response_args.get(
-      'content', loader.render_to_string(template, dictionary=context))
+  if 'content' not in response_args:
+    content = loader.render_to_string(template, dictionary=context)
+    response_args['content'] = content.strip('\n')
+
   http_response = http.HttpResponse(**response_args)
 
   if response_headers: