From 1ba316ff601c5c385be01e40ffa9bfcfc6ebbcb3 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 1 Sep 2021 21:39:44 +0200 Subject: handle results without direction --- bin/nvm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/nvm b/bin/nvm index 6996654..326fa6a 100755 --- a/bin/nvm +++ b/bin/nvm @@ -164,7 +164,7 @@ class Trip: self.cancelled = None self.__dict__.update(obj) - if "," in self.direction: + if self.direction is not None and "," in self.direction: self.direction, self.suffix = self.direction.split(",", maxsplit=1) else: self.suffix = None @@ -425,9 +425,14 @@ async def show_trip_info(request, trip_id=None): tripinfo_page = env.get_template("tripinfo_page.html") + if tripinfo.direction: + page_title = tripinfo.line["name"] + " ➔ " + tripinfo.direction + else: + page_title = tripinfo.line["name"] + return web.Response( body=tripinfo_page.render( - title=tripinfo.line["name"] + " ➔ " + tripinfo.direction, + title=page_title, tripinfo=tripinfo, version=nvm_version, ), -- cgit v1.2.3