Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix error appearing in dev environment:
when the table of contense is created now an error appears. This commit attepst to avoid this error.
- Loading branch information
ac0e8c9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marionb I checked, and when trying to get the pdf extract with 2.4.5 I get following error message:
File "/usr/local/lib/python3.9/site-packages/pyramid_oereb/contrib/print_proxy/mapfish_print/mapfish_print.py", line 118, in __call__ x.append(pdf_reader.outline[i]['/Page']['/StructParents']) TypeError: list indices must be integers or slices, not str
ac0e8c9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marionb @jwkaltz I did some more testing and as it seems, the issue above with 'list' is rather related to the mapfish print version:
Versions up to 29.4 work together with pyramid_oereb 2.4.5 without problems.
Version 3.30 and above lead to the error as the structure of pdf_reader.outline seems to have changed?
ac0e8c9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm OK that is interesting and good to know.
What do you suggest we should add the change or open a separate issue with a clan PR and test the commit above thoroughly?
Actually I got the exact same error message when developing so that was the reason why I added the change.
ac0e8c9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marionb
it would be interesting to ask your mfp developers why the pdf structure changes with 3.30 - is it voluntarily or by 'accident'?
the first element of pdf_reader.outline[i]['/Page']['/StructParents'] is as before, the following elements are in a list for whatever reason. So if it's not an accident, then the new case handling becomes mandatory, otherwise we may just notify the user group that some mfp versions are not compatible and take our time to add the exceptions.
ac0e8c9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, this is the same problem as described in issue 137 over at pyramid_oereb_mfp.
ac0e8c9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is related to changes in MapFish-Print itself, but rather to changes in behavior by the pypdf library used within pyramid_oereb during generation of the print specification. @marionb and I are currently investigating in that direction.
ac0e8c9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peterschaer thanks for pointing that out and the investigations already done - strangely enough it seems I didn't get the notifications back in june for whatever reason.
@jwkaltz thanks for checking the source of this regression