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

[tor-commits] [oonib/master] Fix bug in parsing probe_asn number



commit ad1a62e67cf2703fe469dcfa1a10b799b545029c
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Fri Dec 27 11:46:32 2013 +0100

    Fix bug in parsing probe_asn number
---
 oonib/report/handlers.py |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/oonib/report/handlers.py b/oonib/report/handlers.py
index 0c727ef..82f38b3 100644
--- a/oonib/report/handlers.py
+++ b/oonib/report/handlers.py
@@ -59,7 +59,7 @@ def parseNewReportRequest(request):
     }
 
     parsed_request = json.loads(request)
-    if not parsed_request['probe_asn']:
+    if 'probe_asn' not in parsed_request or not parsed_request['probe_asn']:
         parsed_request['probe_asn'] = 'AS0'
 
     for k, regexp in expected_request.items():
@@ -181,9 +181,9 @@ class NewReportHandlerFile(OONIBHandler):
         # XXX here we should validate and sanitize the request
         try:
             report_data = parseNewReportRequest(self.request.body)
-        except InvalidRequestField, exc:
+        except InvalidRequestField as exc:
             raise e.InvalidRequestField(exc)
-        except MissingField, exc:
+        except MissingField as exc:
             raise e.MissingRequestField(exc)
 
         log.debug("Parsed this data %s" % report_data)



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