commit 6da51ab542f289738540e3fe4a48cfdd8d6c629b Author: Chris Wacek cwacek@cs.georgetown.edu Date: Tue Jan 15 15:44:08 2013 -0500
Option decoders no longer barf on empty input. --- util.py | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/util.py b/util.py index 73c24db..5577ba9 100644 --- a/util.py +++ b/util.py @@ -4,13 +4,16 @@ import shlex def JSON(val): try: return json.loads(val) - except ValueError: + except (ValueError,TypeError): return []
def List(val): - lex = shlex.shlex(val) - lex.whitespace += "[]," - return list(lex) + if val: + lex = shlex.shlex(val) + lex.whitespace += "[]," + return list(lex) + else: + return []
def NullFn(val): return val
tor-commits@lists.torproject.org