diff options
author | emkael <emkael@tlen.pl> | 2015-09-01 12:01:11 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2015-09-01 12:01:11 +0200 |
commit | 873ac6829408854b2a4c64756252627f04286c5d (patch) | |
tree | 6bb9d025c2defbdfcd81272b4ac34e73d665838c | |
parent | 71e03d4ea2686538c94f0bc63ef5a89830ff1db3 (diff) |
* BWS file access cut to minimum
-rw-r--r-- | bidding_data.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bidding_data.py b/bidding_data.py index ba467f6..a56847b 100644 --- a/bidding_data.py +++ b/bidding_data.py @@ -149,12 +149,12 @@ class JFRBidding: __board_number_mapping = {} def __init__(self, bws_file, file_prefix): - connection = pypyodbc.win_connect_mdb(bws_file) - cursor = connection.cursor() - self.__lineup_data = cursor.execute('SELECT * FROM RoundData').fetchall() + with pypyodbc.win_connect_mdb(bws_file) as connection: + cursor = connection.cursor() + self.__lineup_data = cursor.execute('SELECT * FROM RoundData').fetchall() + bid_data = cursor.execute('SELECT * FROM BiddingData').fetchall() self.__round_lineups = self.__parse_lineup_data(self.__lineup_data) - self.__bids = self.__parse_bidding_data( - cursor.execute('SELECT * FROM BiddingData').fetchall()) + self.__bids = self.__parse_bidding_data(bid_data) self.__tournament_prefix = path.splitext( path.realpath(file_prefix + '.html'))[0] self.__tournament_files_match = re.compile( |