Skip to content

Commit

Permalink
Be more defensive
Browse files Browse the repository at this point in the history
  • Loading branch information
teixas committed Apr 25, 2013
1 parent 3ebb335 commit d93b149
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/zope/testbrowser/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def getLink(self, text=None, url=None, id=None, index=0):
matching = []
for elem in links:
matches = (isMatching(elem.text, text) and
isMatching(elem.get('href'), url))
isMatching(elem.get('href', ''), url))

if matches:
matching.append(elem)
Expand Down Expand Up @@ -392,7 +392,7 @@ def _findByLabel(self, label, forms, include_subcontrols=False):
found = []
for wtcontrol in self._findAllControls(forms, include_subcontrols):
for l in wtcontrol.getLabels():
if matches(l):
if l and matches(l):
found.append(wtcontrol)
break
return found
Expand Down Expand Up @@ -1201,6 +1201,7 @@ def getControlLabels(celem, html):
return [l for l in labels if l is not None]

def normalizeWhitespace(string):

return ' '.join(string.split())

def isMatching(string, expr):
Expand Down

0 comments on commit d93b149

Please sign in to comment.