diff --git a/src/zope/testbrowser/browser.py b/src/zope/testbrowser/browser.py index b3a7248..acd7eb4 100644 --- a/src/zope/testbrowser/browser.py +++ b/src/zope/testbrowser/browser.py @@ -431,8 +431,8 @@ def _findByLabel(self, label, forms, include_subcontrols=False): control = getattr(wtcontrol, 'control', wtcontrol) if control.type == 'hidden': continue - for l in wtcontrol.labels: - if matches(l): + for label in wtcontrol.labels: + if matches(label): found.append(wtcontrol) break return found @@ -742,8 +742,8 @@ def __repr__(self): @Lazy def labels(self): - return [self.browser.toStr(l) - for l in getControlLabels(self._elem, self._form.html)] + return [self.browser.toStr(label) + for label in getControlLabels(self._elem, self._form.html)] @property def controls(self): @@ -789,7 +789,7 @@ def labels(self): labels.append(self._control.value_if_submitted()) if self._elem.text: labels.append(normalizeWhitespace(self._elem.text)) - return [l for l in labels if l] + return [label for label in labels if label] def mechRepr(self): name = self.name if self.name is not None else "" @@ -1166,8 +1166,8 @@ def optionValue(self): @Lazy def labels(self): - return [self.browser.toStr(l) - for l in getControlLabels(self._elem, self._form.html)] + return [self.browser.toStr(label) + for label in getControlLabels(self._elem, self._form.html)] def __repr__(self): return ( @@ -1226,8 +1226,8 @@ def optionValue(self): @Lazy def labels(self): - return [self.browser.toStr(l) - for l in getControlLabels(self._elem, self._form.html)] + return [self.browser.toStr(label) + for label in getControlLabels(self._elem, self._form.html)] def __repr__(self): return ( @@ -1375,7 +1375,8 @@ def getControl(controls, label=None, value=None, index=None): if label is not None: options = [c for c in controls - if any(isMatching(l, label) for l in c.labels)] + if any(isMatching(control_label, label) + for control_label in c.labels)] msg = 'label %r' % label elif value is not None: options = [c for c in controls if isMatching(c.value, value)] @@ -1397,9 +1398,9 @@ def getControlLabels(celem, html): controlid = celem.attrs.get('id') if controlid: forlbls = html.select('label[for="%s"]' % controlid) - labels.extend([normalizeWhitespace(l.text) for l in forlbls]) + labels.extend([normalizeWhitespace(label.text) for label in forlbls]) - return [l for l in labels if l is not None] + return [label for label in labels if label is not None] def normalizeWhitespace(string):