commit ae549520175fd0f764143954faa5ce299435251d Author: Darius Bacon darius@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):