From 0a2aa21777faf3d5f894fb19c9c727e94cc4d568 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Fri, 27 Jul 2012 17:42:12 -0500 Subject: [PATCH] Storycraft: don't try to replace() on end_time when it's None --- modules/Storycraft.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/Storycraft.py b/modules/Storycraft.py index 7492004..5535b2f 100644 --- a/modules/Storycraft.py +++ b/modules/Storycraft.py @@ -557,7 +557,9 @@ class Storycraft(Module): game.owner_nick = result['owner_nick'] game.owner_userhost = result['owner_userhost'] game.start_time = result['start_time'].replace(tzinfo=tzlocal()) - game.end_time = result['end_time'].replace(tzinfo=tzlocal()) + game.end_time = result['end_time'] + if game.end_time is not None: + game.end_time = game.end_time.replace(tzinfo=tzlocal()) return game except mdb.Error as e: @@ -864,7 +866,9 @@ class Storycraft(Module): game.owner_nick = result['owner_nick'] game.owner_userhost = result['owner_userhost'] game.start_time = result['start_time'].replace(tzinfo=tzlocal()) - game.end_time = result['end_time'].replace(tzinfo=tzlocal()) + game.end_time = result['end_time'] + if game.end_time is not None: + game.end_time = game.end_time.replace(tzinfo=tzlocal()) games.append(game) @@ -917,7 +921,9 @@ class Storycraft(Module): game.owner_nick = result['owner_nick'] game.owner_userhost = result['owner_userhost'] game.start_time = result['start_time'].replace(tzinfo=tzlocal()) - game.end_time = result['end_time'].replace(tzinfo=tzlocal()) + game.end_time = result['end_time'] + if game.end_time is not None: + game.end_time = game.end_time.replace(tzinfo=tzlocal()) games.append(game) @@ -957,7 +963,9 @@ class Storycraft(Module): game.owner_nick = result['owner_nick'] game.owner_userhost = result['owner_userhost'] game.start_time = result['start_time'].replace(tzinfo=tzlocal()) - game.end_time = result['end_time'].replace(tzinfo=tzlocal()) + game.end_time = result['end_time'] + if game.end_time is not None: + game.end_time = game.end_time.replace(tzinfo=tzlocal()) games.append(game)