Commit daa27da3 authored by Romain Bignon's avatar Romain Bignon

Weboob.iter_backends() does not return backend name anymore

parent 3ea53cd2
......@@ -96,7 +96,7 @@ class Monboob(ConsoleApplication):
self.weboob.loop()
def process(self):
for name, backend in self.weboob.iter_backends():
for backend in self.weboob.iter_backends():
for message in backend.iter_new_messages():
self.send_email(backend, message)
......
......@@ -39,13 +39,13 @@ class Boobank(ConsoleApplication):
@ConsoleApplication.command('List every available accounts')
def command_list(self):
accounts = []
for name, backend, in self.weboob.iter_backends():
for backend, in self.weboob.iter_backends():
try:
for account in backend.iter_accounts():
accounts.append('%17s %-20s %11.2f %11.2f' % (
account.id, account.label, account.balance, account.coming))
except weboob.tools.browser.BrowserIncorrectPassword:
print >>sys.stderr, 'Error: Incorrect password for backend %s' % name
print >>sys.stderr, 'Error: Incorrect password for backend %s' % backend.name
return 1
if len(accounts):
print ' ID Account Balance Coming '
......@@ -58,7 +58,7 @@ class Boobank(ConsoleApplication):
def command_coming(self, id):
operations = []
found = 0
for name, backend in self.weboob.iter_backends():
for backend in self.weboob.iter_backends():
try:
account = backend.get_account(id)
except AccountNotFound:
......
......@@ -31,8 +31,8 @@ class Dummy(BaseApplication):
def main(self, argv):
self.weboob.load_backends()
for name, backend in self.weboob.iter_backends():
print 'Backend [%s]' % name
for backend in self.weboob.iter_backends():
print 'Backend [%s]' % backend.name
if backend.has_caps(ICapMessages):
print '|- ICapMessages [Print its messages]'
for message in backend.iter_messages():
......
......@@ -59,5 +59,5 @@ class HaveSex(PromptApplication):
@PromptApplication.command("start profiles walker")
def command_walker(self):
for name, backend in self.weboob.iter_backends():
for backend in self.weboob.iter_backends():
backend.start_profiles_walker()
......@@ -35,7 +35,7 @@ class Travel(ConsoleApplication):
print '| ID | Name |'
print '+--------------------------------+---------------------------------------------+'
count = 0
for name, backend, in self.weboob.iter_backends():
for backend, in self.weboob.iter_backends():
for station in backend.iter_station_search(pattern):
print '| %-31s| %-44s|' % (station.id, station.name)
count += 1
......@@ -49,7 +49,7 @@ class Travel(ConsoleApplication):
print "| ID | Type | Time | Arrival | Late | Info | Plateform |"
print "+-----+-----------+-------+-----------------------+-------+--------------------+-----------+"
count = 0
for name, backend, in self.weboob.iter_backends():
for backend, in self.weboob.iter_backends():
for departure in backend.iter_station_departures(station, arrival):
print u"|%4d | %-10s|%6s | %-22s|%6s | %-19s| %-10s|" % (departure.id,
departure.type,
......
......@@ -87,7 +87,7 @@ class TransilienUI():
liste = []
#liste = ConfFile('/opt/masstransit/masstransit.cfg').config.items('ListeDesGares')
for name, backend in self.weboob.iter_backends():
for backend in self.weboob.iter_backends():
for station in backend.iter_station_search(""):
liste.append(station)
......@@ -141,7 +141,7 @@ class TransilienUI():
def refresh(self):
"update departures"
self.treestore.clear()
for name, backend in self.weboob.iter_backends():
for backend in self.weboob.iter_backends():
for station in backend.iter_station_search(self.combo_source.get_current_text()):
for arrival in backend.iter_station_search(self.combo_dest.get_current_text()):
for departure in backend.iter_station_departures(station.id, arrival.id):
......
......@@ -31,7 +31,7 @@ class Videoob(ConsoleApplication):
@ConsoleApplication.command('Get video file URL from page URL')
def command_file_url(self, url):
for name, backend in self.weboob.iter_backends(ICapVideoProvider):
for backend in self.weboob.iter_backends(ICapVideoProvider):
video_url = backend.get_video_url(url)
if video_url:
print video_url
......@@ -39,7 +39,7 @@ class Videoob(ConsoleApplication):
@ConsoleApplication.command('Get video title from page URL')
def command_title(self, url):
for name, backend in self.weboob.iter_backends(ICapVideoProvider):
for backend in self.weboob.iter_backends(ICapVideoProvider):
video_title = backend.get_video_title(url)
if video_title:
print video_title
......
......@@ -106,8 +106,8 @@ class WeboobCfg(ConsoleApplication):
@ConsoleApplication.command('Remove a backend')
def command_remove(self, name):
if not name in self.weboob.backends_config.iter_backends():
try:
self.weboob.backends_config.remove_backend(name)
except ConfigParser.NoSectionError:
print >>sys.stderr, "Backend '%s' does not exist" % name
return 1
self.weboob.backends_config.remove_backend(name)
......@@ -35,7 +35,7 @@ class WetBoobs(ConsoleApplication):
print '| ID | Name |'
print '+--------------------------------+---------------------------------------------+'
count = 0
for name, backend, in self.weboob.iter_backends():
for backend, in self.weboob.iter_backends():
for city in backend.iter_city_search(pattern):
print u'| %-31s| %-44s|' % (city.city_id, city.name)
count += 1
......@@ -49,7 +49,7 @@ class WetBoobs(ConsoleApplication):
print '| Temperature | Text |'
print '+-------------+----------------------------------------------------------------+'
found = 0
for name, backend, in self.weboob.iter_backends():
for backend, in self.weboob.iter_backends():
try:
current = backend.get_current(city)
print u'| %-12s| %-63s|' % (u'%d °%s' % (current.temp, current.unit), current.text)
......@@ -67,7 +67,7 @@ class WetBoobs(ConsoleApplication):
print '| Date | Min | Max | Text |'
print '+-------------+-------+-------+------------------------------------------------+'
found = 0
for name, backend, in self.weboob.iter_backends():
for backend, in self.weboob.iter_backends():
try:
for f in backend.iter_forecast(city):
found = 1
......
......@@ -88,7 +88,7 @@ class Weboob:
def iter_backends(self, caps=None):
for name, backend in self.backends.iteritems():
if caps is None or backend.has_caps(caps):
yield (name, backend)
yield backend
def schedule(self, interval, function, *args):
return self.scheduler.schedule(interval, function, *args)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment