diff options
author | emkael <emkael@tlen.pl> | 2017-01-06 00:26:57 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-01-06 00:26:57 +0100 |
commit | 3827de159894a294af1eef25ae365f8c716e1c1b (patch) | |
tree | 5925dff563da656d4665644a57d1609fbd4bbfe8 /ausbutler | |
parent | 08b831eed0d2da87dee6ea7c539ad3cdef49fe99 (diff) |
Generating frame pages for segment pages
Diffstat (limited to 'ausbutler')
-rw-r--r-- | ausbutler/interface.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/ausbutler/interface.py b/ausbutler/interface.py index 4605f73..30c2f70 100644 --- a/ausbutler/interface.py +++ b/ausbutler/interface.py @@ -1,10 +1,11 @@ import re +from os import path from jinja2 import Environment, FileSystemLoader from .butler import cutoff, get_opponents, get_room, normalize from .db import get_session from .model import AusButler, Butler -from .tour_config import Translations +from .tour_config import Translations, Constants class Interface(object): @@ -74,3 +75,22 @@ class Interface(object): butler.corrected_score = normalize( butler, self.config['opponent_factor']) self.session.commit() + + def generate_frames(self): + template = self.template.get_template('frame.html') + for round_no in range(1, Constants.rnd + 1): + for segment_no in range(1, Constants.segmentsperround + 1): + first_board = 1 + (segment_no - 1) * Constants.boardspersegment + filename = '%snormbutler%d-%d.htm' % ( + Constants.shortname, + round_no, segment_no + ) + file(path.join(Constants.path, filename), 'w').write( + template.render({ + 'prefix': Constants.shortname, + 'round_no': round_no, + 'segment_no': segment_no, + 'first_board': first_board + }) + ) + |