With yield instead of return a list

This commit is contained in:
Florent 2012-04-26 18:53:08 +02:00
commit a4c8a1abf7

View file

@ -28,7 +28,6 @@ __all__ = ['ListPage', 'HistoryPage']
class ListPage(BasePage):
def get_rivers_list(self):
l = []
for pegel in self.document.getroot().xpath(".//a[@onmouseout='pegelaus()']"):
data = pegel.attrib['onmouseover'].strip('pegelein(').strip(')').replace(",'", ",").split("',")
gauge = Gauge(int(data[7]))
@ -56,8 +55,7 @@ class ListPage(BasePage):
else:
gauge.forecast = NotAvailable
l.append(gauge)
return l
yield gauge
class HistoryPage(BasePage):