[tor-commits] [pyonionoo/master] Fix search

karsten at torproject.org karsten at torproject.org
Thu Sep 27 00:24:34 UTC 2012


commit 31e9ae838aa589463eaa25219d774b3fae09a1ef
Author: Sathyanarayanan Gunasekaran <gsathya.ceg at gmail.com>
Date:   Tue Sep 25 19:31:26 2012 +0530

    Fix search
    
    Exlude '$' if prefixed. 'filter' is a python keyword,
    lets use 'search_string' instead.
---
 pyonionoo/database.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/pyonionoo/database.py b/pyonionoo/database.py
index a553629..7ba7c02 100644
--- a/pyonionoo/database.py
+++ b/pyonionoo/database.py
@@ -195,8 +195,10 @@ def query_summary_tbl(running_filter=None, type_filter=None, hex_fingerprint_fil
     # some subset (possibly empty) of {'running', 'type', 'lookup', 'country'}.
     clauses = []
     if search_filter:
-        for filter in search_filter:
-            clauses.append("search like '%% %s%%'" % filter)
+        for search_string in search_filter:
+            if search_string[0] == '$':
+                search_string = ''.join(search_string[1:])
+            clauses.append("search like '%% %s%%'" % search_string)
     if running_filter:
         clauses.append("running = %s" % int(running_filter))
     if type_filter:





More information about the tor-commits mailing list