[tor-commits] [pyonionoo/master] Add missing fields in /summary?type=foo

karsten at torproject.org karsten at torproject.org
Tue Sep 18 01:57:10 UTC 2012


commit 22b61026361f1c859a54fe9cbac51f994ac452cc
Author: Sathyanarayanan Gunasekaran <gsathya.ceg at gmail.com>
Date:   Sun Sep 16 19:44:55 2012 +0530

    Add missing fields in /summary?type=foo
---
 pyonionoo/handlers/summary.py |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/pyonionoo/handlers/summary.py b/pyonionoo/handlers/summary.py
index 5502e9d..7260c77 100644
--- a/pyonionoo/handlers/summary.py
+++ b/pyonionoo/handlers/summary.py
@@ -14,7 +14,6 @@ from pyonionoo.parser import Router
 ARGUMENTS = ['type', 'running', 'search', 'lookup', 'country', 'order', 'offset', 'limit']
 
 class SummaryHandler(cyclone.web.RequestHandler):
-
     @defer.inlineCallbacks
     def get(self):
         """
@@ -29,7 +28,6 @@ class SummaryHandler(cyclone.web.RequestHandler):
         self.write(response)
         
     def _get_results(self):
-
         user_arguments = self.request.arguments
         routers = database.get_summary_routers(**arguments.parse(user_arguments))
 
@@ -46,12 +44,12 @@ class SummaryHandler(cyclone.web.RequestHandler):
                     'r' : bool(router['running'])
                 })
 
-        if relays:
-            response['relays'] = relays
-            response['relays_published'] = relay_timestamp.strftime("%Y-%m-%d %H:%M:%S")
-        if bridges:
-            response['bridges'] = bridges
-            response['bridges_published'] = bridge_timestamp.strftime("%Y-%m-%d %H:%M:%S")
+        # response is a dict, so the order is not maintained. should the
+        # values in the response be in a specific order?
+        response['relays'] = relays
+        response['relays_published'] = relay_timestamp.strftime("%Y-%m-%d %H:%M:%S")
+        response['bridges'] = bridges
+        response['bridges_published'] = bridge_timestamp.strftime("%Y-%m-%d %H:%M:%S")
 
         return response
 





More information about the tor-commits mailing list