From 752e50ad4c75ed358609134903136a84cbd5ea80 Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Wed, 25 Nov 2009 07:26:26 +0200 Subject: [PATCH] Better test Built-in function hasattr() deals with and hides the exception --- pyfpdb/HUD_main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pyfpdb/HUD_main.py b/pyfpdb/HUD_main.py index 89436c52..5b2cc085 100755 --- a/pyfpdb/HUD_main.py +++ b/pyfpdb/HUD_main.py @@ -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()