From 479bc584894d74434b850afa5a71be6782ed40a4 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Mon, 2 Oct 2017 12:26:19 +0200 Subject: [PATCH] Fix via station handling --- classes/connection.py | 4 ++-- workers/conn.py | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/classes/connection.py b/classes/connection.py index 8539d1c..f147a23 100644 --- a/classes/connection.py +++ b/classes/connection.py @@ -70,8 +70,8 @@ class Connection: out += " " * indent + " \n" out += self.depst().xml(indent + 2, **stationkwargs) + "\n" out += " " * indent + " \n" - - if via and self.via: + + if via and self.via != 0: out += " " * indent + " \n" for vst in self.via: diff --git a/workers/conn.py b/workers/conn.py index 71a03f4..378ca7e 100644 --- a/workers/conn.py +++ b/workers/conn.py @@ -126,11 +126,14 @@ def connRequest(frm, to, count = 3, time = datetime.datetime.now(), mode = False # ticketurl = det.find("td", { "class": "fares" }).find("a").get("href") svc = Service(name, depst, depts, arrst, arrts, currdep = curdep, curarr = curarr) - con = Connection(details) + conn = Connection(details) - con.addService(svc) + for vst in via: + conn.addVia(vst) - yield con + conn.addService(svc) + + yield conn def worker(frm, to, count = 3, time = datetime.datetime.now(pytz.timezone("Europe/Vienna")), mode = False, details = False, json = False, via = None): conns = list(connRequest(getStation(frm), getStation(to), count, time, mode, details, [getStation(vst) for vst in via]))