[tor-commits] [compass/master] Fix for #7924.

karsten at torproject.org karsten at torproject.org
Mon Jan 14 09:23:29 UTC 2013


commit 8c2259c944f8e737a7728c74e9e5dcd3e8534bf2
Author: Chris Wacek <cwacek at cs.georgetown.edu>
Date:   Fri Jan 11 11:11:28 2013 -0500

    Fix for #7924.
    
    AS filters weren't being correctly treated as lists. Now they are.
---
 app.py               |    6 +++---
 templates/index.html |    6 +++---
 util.py              |    8 +++++++-
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/app.py b/app.py
index f323ebc..45217a6 100644
--- a/app.py
+++ b/app.py
@@ -1,7 +1,7 @@
 import os
 import re
 import compass
-from util import Result,Boolean,NullFn,Int,Container,ResultEncoder
+from util import Result,Boolean,NullFn,Int,List,ResultEncoder,JSON
 import json
 from flask import Flask, request, jsonify, render_template,Response
 
@@ -19,8 +19,8 @@ class Opt(object):
       'sort_reverse':Boolean,
       'top':Int,
       'family':NullFn,
-      'ases':NullFn,
-      'country':Container,
+      'ases':List,
+      'country':JSON,
       'exit_filter':NullFn
     }
 
diff --git a/templates/index.html b/templates/index.html
index 158ae53..1800c7a 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -285,9 +285,9 @@
     <script src="static/js/jquery-1.8.0.min.js"></script>
     <script src="static/js/bootstrap.min.js"></script>
     <script src="static/js/bootstrap-tooltip.js"></script>
-    <script src="static/lib/select2/select2.js" type="text/javascript"></script>
-    <script src="static/js/angular/angular.js"> </script>
-    <script src="static/lib/angular-ui/angular-ui.js"></script>
+    <script src="static/lib/select2/select2.min.js" type="text/javascript"></script>
+    <script src="static/js/angular/angular.min.js"> </script>
+    <script src="static/lib/angular-ui/angular-ui.min.js"></script>
     <script src="static/js/directives.js"></script>
     <script src="static/js/filters.js"></script>
     <script src="static/js/angularize.js"></script>
diff --git a/util.py b/util.py
index 2ae6a37..73c24db 100644
--- a/util.py
+++ b/util.py
@@ -1,11 +1,17 @@
 import json
+import shlex
 
-def Container(val):
+def JSON(val):
   try:
     return json.loads(val)
   except ValueError:
     return []
 
+def List(val):
+  lex = shlex.shlex(val)
+  lex.whitespace += "[],"
+  return list(lex)
+
 def NullFn(val):
   return val
 



More information about the tor-commits mailing list