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

art at torproject.org art at torproject.org
Fri Jun 7 23:24:06 UTC 2013


commit f7e298d95c792965f481f5002e2724471e1be6e1
Author: Arturo Filastò <art at fuffa.org>
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"





More information about the tor-commits mailing list