From: Florian Schweikert Date: Fri, 25 Nov 2011 18:01:36 +0000 (+0100) Subject: fixing lowfloor bug X-Git-Url: http://vcs.maemo.org/git/?p=pywienerlinien;a=commitdiff_plain;h=a10787e99362a93e6d5ddb6f8174fc0e3a91cb12 fixing lowfloor bug --- diff --git a/gotovienna/realtime.py b/gotovienna/realtime.py index 8e665e3..5a48327 100644 --- a/gotovienna/realtime.py +++ b/gotovienna/realtime.py @@ -215,6 +215,7 @@ class ITipParser: for tr in result_lines[1:]: d = {'station': station} th = tr.findAll('th') + if len(th) < 2: #TODO replace with logger print "[DEBUG] Unable to find th in:\n%s" % str(tr) @@ -226,7 +227,8 @@ class ITipParser: t = th[-1] else: # all other lines - d['lowfloor'] = th[-1].has_key('img') and th[-1].img.has_key('alt') + print th[-1].find('img') and th[-1].img.has_key('alt') + d['lowfloor'] = th[-1].find('img') and th[-1].img.has_key('alt') d['line'] = th[0].text.replace(' ', '') d['direction'] = th[1].text.replace(' ', '') t = th[-2]