Skip to content

Commit

Permalink
Move toc_calculation handling further down
Browse files Browse the repository at this point in the history
  • Loading branch information
peterschaer committed Dec 18, 2024
1 parent 509abbd commit 7dd2b88
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions pyramid_oereb/contrib/print_proxy/mapfish_print/mapfish_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,6 @@ def __call__(self, value, system):

print_config = Config.get('print', {})

if print_config.get('compute_toc_pages', False):
extract_as_dict['nbTocPages'] = TocPages(extract_as_dict).getNbPages()
else:
if print_config.get('expected_toc_length') and int(print_config.get('expected_toc_length')) > 0:
extract_as_dict['nbTocPages'] = print_config.get('expected_toc_length')
else:
extract_as_dict['nbTocPages'] = 1

# set the global_datetime variable so that it can be used later for the archive
self.set_global_datetime(extract_as_dict['CreationDate'])
self.convert_to_printable_extract(extract_as_dict, feature_geometry)
Expand All @@ -102,7 +94,10 @@ def __call__(self, value, system):
if print_config.get('compute_toc_pages', False):
extract_as_dict['nbTocPages'] = TocPages(extract_as_dict).getNbPages()
else:
extract_as_dict['nbTocPages'] = 1
if print_config.get('expected_toc_length') and int(print_config.get('expected_toc_length')) > 0:
extract_as_dict['nbTocPages'] = print_config.get('expected_toc_length')

Check warning on line 98 in pyramid_oereb/contrib/print_proxy/mapfish_print/mapfish_print.py

View check run for this annotation

Codecov / codecov/patch

pyramid_oereb/contrib/print_proxy/mapfish_print/mapfish_print.py#L97-L98

Added lines #L97 - L98 were not covered by tests
else:
extract_as_dict['nbTocPages'] = 1

Check warning on line 100 in pyramid_oereb/contrib/print_proxy/mapfish_print/mapfish_print.py

View check run for this annotation

Codecov / codecov/patch

pyramid_oereb/contrib/print_proxy/mapfish_print/mapfish_print.py#L100

Added line #L100 was not covered by tests

spec = {
'layout': print_config['template_name'],
Expand Down

0 comments on commit 7dd2b88

Please sign in to comment.