From 8b17b2b021d95f9b6347152e4e95f61005a8c080 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 10 Oct 2018 02:23:12 +0200 Subject: Ability to override output path in config --- ausbutler/interface.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ausbutler/interface.py') diff --git a/ausbutler/interface.py b/ausbutler/interface.py index 2170f67..d19ba7e 100644 --- a/ausbutler/interface.py +++ b/ausbutler/interface.py @@ -21,6 +21,7 @@ class Interface(object): print 'Tournament name: %s' % (db_config['db']) self.session = get_session(db_config) self.config = config + self.output_path = self.config.get('output_path', Constants.path) self.translation = Translations() self.template = Environment(loader=FileSystemLoader('template')) self.template.filters['translate'] = self.translation.get_translation @@ -143,7 +144,7 @@ class Interface(object): Constants.shortname, round_no, segment_no ) - file(path.join(Constants.path, filename), 'w').write( + file(path.join(self.output_path, filename), 'w').write( template.render({ 'prefix': Constants.shortname, 'round_no': round_no, @@ -193,7 +194,7 @@ class Interface(object): results[r]['place'] = place previous = results[r]['norm_score'] place += 1 - file(path.join(Constants.path, filename), 'w').write( + file(path.join(self.output_path, filename), 'w').write( template.render({ 'prefix': Constants.shortname, 'logoh': Constants.logoh, @@ -275,7 +276,7 @@ class Interface(object): player['place'] = place prev = player['sum'] place += 1 - file(path.join(Constants.path, filename), 'w').write( + file(path.join(self.output_path, filename), 'w').write( template.render({ 'prefix': Constants.shortname, 'logoh': Constants.logoh, -- cgit v1.2.3