Skip to content

Commit

Permalink
be extra-careful about validation
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Jan 12, 2013
1 parent 9a8fcf8 commit e0f133b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions master/buildbot/test/util/validation.py
Expand Up @@ -174,7 +174,10 @@ def __init__(self, keyFields, events, messageValidator):
self.messageValidator = messageValidator

def validate(self, name, routingKey_message):
routingKey, message = routingKey_message
try:
routingKey, message = routingKey_message
except (TypeError, ValueError) as e:
yield "%r: not a routing key and message: %s" % (routingKey_message, e)
routingKeyBad = False
for msg in self.routingKeyValidator.validate("routingKey", routingKey):
yield msg
Expand Down Expand Up @@ -208,7 +211,10 @@ def add(self, selector, validator):
self.selectors.append((selector, validator))

def validate(self, name, arg_object):
arg, object = arg_object
try:
arg, object = arg_object
except (TypeError, ValueError) as e:
yield "%r: not a not data options and data dict: %s" % (arg_object, e)
for selector, validator in self.selectors:
if selector is None or selector(arg):
for msg in validator.validate(name, object):
Expand Down

0 comments on commit e0f133b

Please sign in to comment.