[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [oonib/master] Use YAML instead of JSON for encoding the content



commit f7e298d95c792965f481f5002e2724471e1be6e1
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Thu Jun 6 22:45:19 2013 +0200

    Use YAML instead of JSON for encoding the content
---
 oonib/report/file_collector.py |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/oonib/report/file_collector.py b/oonib/report/file_collector.py
index 8211fe9..422c94b 100644
--- a/oonib/report/file_collector.py
+++ b/oonib/report/file_collector.py
@@ -1,5 +1,6 @@
 import random
 import string
+import yaml
 import json
 import re
 import os
@@ -131,9 +132,10 @@ class NewReportHandlerFile(web.RequestHandler):
         test_name = report_data['test_name']
         test_version = report_data['test_version']
         probe_asn = report_data['probe_asn']
-        content = json.loads(report_data['content'])
+        content = yaml.safe_load(report_data['content'])
         content['backend_version'] = config.backend_version
-        content = json.dumps(content)
+        serialized_content = yaml.dump(content)
+        content = "---\n" + serialized_content + '...\n'
 
         if not probe_asn:
             probe_asn = "AS0"



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits