From c8345be8af86ae12d12e3d9a70e74e75a176e857 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Sat, 27 May 2017 12:12:16 +0200 Subject: Debianless Age --- debdate | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/debdate b/debdate index 39af2ea..e602f63 100755 --- a/debdate +++ b/debdate @@ -34,6 +34,7 @@ RELEASES = [ (datetime.date(1996, 6, 17), 'buzz'), ] MSG = "Today is day {dody} of year {yodr} of the {release}" +ERR_MSG = "Today is {isodate} of the Debianless Age" class DebDate: @@ -160,8 +161,12 @@ class Command: else: date = datetime.date.today() debdate = DebDate() - data = debdate.get_release(date) - print(MSG.format(**data)) + try: + data = debdate.get_release(date) + except OutsideTimeError: + print(ERR_MSG.format(isodate=date.strftime("%Y-%m-%d"))) + else: + print(MSG.format(**data)) def main(self): self.setup_parser() -- cgit v1.2.3