From 873ac6829408854b2a4c64756252627f04286c5d Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 1 Sep 2015 12:01:11 +0200 Subject: * BWS file access cut to minimum --- bidding_data.py | 10 +++++----- 1 file 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( -- cgit v1.2.3