[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [compass/master] Option decoders no longer barf on empty input.
commit 6da51ab542f289738540e3fe4a48cfdd8d6c629b
Author: Chris Wacek <cwacek@xxxxxxxxxxxxxxxxx>
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 mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits