Better test
Built-in function hasattr() deals with and hides the exception
This commit is contained in:
parent
92918df8c5
commit
752e50ad4c
|
@ -253,10 +253,9 @@ class HUD_main(object):
|
||||||
tablewindow.max = max
|
tablewindow.max = max
|
||||||
tablewindow.site = site_name
|
tablewindow.site = site_name
|
||||||
# Test that the table window still exists
|
# Test that the table window still exists
|
||||||
try:
|
if hasattr(tablewindow, 'name'):
|
||||||
_n = tablewindow.name
|
|
||||||
self.create_HUD(new_hand_id, tablewindow, temp_key, max, poker_game, type, stat_dict, cards)
|
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)
|
sys.stderr.write('Table "%s" no longer exists\n', table_name)
|
||||||
|
|
||||||
self.db_connection.connection.rollback()
|
self.db_connection.connection.rollback()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user