Better test

Built-in function hasattr() deals with and hides the exception
This commit is contained in:
Mika Bostrom 2009-11-25 07:26:26 +02:00
parent 92918df8c5
commit 752e50ad4c

View File

@ -253,10 +253,9 @@ class HUD_main(object):
tablewindow.max = max
tablewindow.site = site_name
# Test that the table window still exists
try:
_n = tablewindow.name
if hasattr(tablewindow, 'name'):
self.create_HUD(new_hand_id, tablewindow, temp_key, max, poker_game, type, stat_dict, cards)
except AttributeError:
else:
sys.stderr.write('Table "%s" no longer exists\n', table_name)
self.db_connection.connection.rollback()