Storycraft: don't try to replace() on end_time when it's None

This commit is contained in:
Brian S. Stephan 2012-07-27 17:42:12 -05:00
parent b48b016693
commit 0a2aa21777
1 changed files with 12 additions and 4 deletions

View File

@ -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)