Flat better than nested
This commit is contained in:
parent
4831ebb427
commit
db8b34e618
|
@ -18,11 +18,13 @@ class Result(object):
|
||||||
|
|
||||||
def _handle_error(self):
|
def _handle_error(self):
|
||||||
error = self.tree.find('error')
|
error = self.tree.find('error')
|
||||||
if error:
|
if not error:
|
||||||
code = error.find('code').text
|
return
|
||||||
msg = error.find('msg').text
|
|
||||||
tmpl = 'Error {code}: {msg}'
|
code = error.find('code').text
|
||||||
raise Exception(tmpl.format(code=code, msg=msg))
|
msg = error.find('msg').text
|
||||||
|
tmpl = 'Error {code}: {msg}'
|
||||||
|
raise Exception(tmpl.format(code=code, msg=msg))
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return (Pod(node) for node in self.tree.findall('pod'))
|
return (Pod(node) for node in self.tree.findall('pod'))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user