Export CSV support for spreadsheet view.
* new Django view, handle_csv(), with a new URLconf, /new_tko/server/csv/
* new module csv_encoder with logic to encode the results of an RPC call into CSV format
* logic in csv_encoder to convert results of get_status_counts() (or get_latest_tests()) into CSV, when called from spreadsheet view
* added optional "Export to CSV" link to TableActionsPanel, and made SpreadsheetView use it with a handler to call the /csv/ entry point with the current query info

Signed-off-by: Steve Howard <showard@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@3086 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/afe/rpc_utils.py b/frontend/afe/rpc_utils.py
index 0bef95e..082a53e 100644
--- a/frontend/afe/rpc_utils.py
+++ b/frontend/afe/rpc_utils.py
@@ -6,6 +6,7 @@
 __author__ = 'showard@google.com (Steve Howard)'
 
 import datetime, os
+import django.http
 from frontend.afe import models, model_logic
 
 NULL_DATETIME = datetime.datetime.max
@@ -66,6 +67,12 @@
         return data
 
 
+def raw_http_response(response_data, content_type=None):
+    response = django.http.HttpResponse(response_data, mimetype=content_type)
+    response['Content-length'] = str(len(response.content))
+    return response
+
+
 def gather_unique_dicts(dict_iterable):
     """\
     Pick out unique objects (by ID) from an iterable of object dicts.