[tor-commits] [oonib/master] More-direct code for validateNettest, as long as I'm messing with it. You could do the same to validateInputHash.
art at torproject.org
art at torproject.org
Wed Apr 23 14:31:51 UTC 2014
commit fcd5b892f03431bc79978321320453423931cbf6
Author: Darius Bacon <darius at wry.me>
Date: Fri Mar 28 11:36:00 2014 -0700
More-direct code for validateNettest, as long as I'm messing with it. You could do the same to validateInputHash.
---
oonib/policy/handlers.py | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/oonib/policy/handlers.py b/oonib/policy/handlers.py
index 83a7f24..ac12c00 100644
--- a/oonib/policy/handlers.py
+++ b/oonib/policy/handlers.py
@@ -33,15 +33,9 @@ class Policy(object):
def validateNettest(self, nettest_name):
# XXX add support for version checking too.
- valid = False
- if not self.nettest:
- valid = True
- for nt in self.nettest:
- if nettest_name == nt['name']:
- valid = True
- break
- if not valid:
- raise e.InvalidNettestName
+ if self.nettest:
+ if not any(nt['name'] == nettest_name for nt in self.nettest):
+ raise e.InvalidNettestName
class PolicyHandler(OONIBHandler):
def initialize(self):
More information about the tor-commits
mailing list