Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error exporting PDF timetable with a long abstract #4881

Closed
bcc opened this issue Apr 19, 2021 · 0 comments · Fixed by #4955
Closed

Error exporting PDF timetable with a long abstract #4881

bcc opened this issue Apr 19, 2021 · 0 comments · Fixed by #4955
Assignees
Labels

Comments

@bcc
Copy link
Contributor

bcc commented Apr 19, 2021

Describe the bug
Exporting a PDF timetable fails if the user selects the advanced options and ticks 'Print abstract content of all contributions' when an abstract contains too much text.

The user sees the following error message, which is not especially friendly:
LayoutError: Flowable <Table@0x7FCA0B097EA8 1 rows x 3 cols(tallest row 4042)> with cell(0,0) containing ' '(526.582677165 x 4042), tallest cell 4042.0 points, too large on page 2 in frame 'normal'(526.582677165 x 773.196850394*) of template 'Later'

To Reproduce
Steps to reproduce the behavior:

  1. Create a new event with a single session.
  2. Create a contribution abstract with a large quantity of text. I generated ~50 paragraphs of lorem ipsum text - this is overkill, but it demonstrates the issue nicely.
  3. Schedule that contribution for a session.
  4. Go to the standard timetable page for the event.
  5. Click 'PDF', and set the 'Advanced timetable' slider to 'yes'
  6. Tick 'Print abstract content of all contributions', and 'Generate'

Expected behavior
Ideally a PDF without error, but a more friendly error message and not emailing an unexpected exception would be better than nothing. I did find https://groups.google.com/g/reportlab-users/c/wlIN3Fsg2VA which suggests it's not likely to be fixed in reportlab any time soon.

Additional context
Full exception from my test instance:

2021-04-19 11:20:37,526  INFO     6974923bae04427b  indico.rh                 GET /event/1/timetable/ [IP=10.0.3.1] [PID=13430] [UID=1]
2021-04-19 11:20:39,782  INFO     9ca39d81354b4da6  indico.rh                 GET /event/1/timetable/pdf?_=1618831238112 [IP=10.0.3.1] [PID=13434] [UID=1]
2021-04-19 11:20:52,011  INFO     45921e3056bf4cda  indico.rh                 GET /event/1/timetable/pdf?submitted=&advanced=y&document_settings=showCoverPage&document_settings=showTableContents&document_settings=showSessionTOC&contribution_info=showContribId&contribution_info=showAbstract&session_info=useSe
ssionColorCodes&session_info=showSessionDescription&visible_entries=showContribsAtConfLevel&visible_entries=showBreaksAtConfLevel&pagesize=A4&firstPageNumber=1 [IP=10.0.3.1] [PID=13434] [UID=1]
2021-04-19 11:20:52,102  INFO     9773cea304d44646  indico.rh                 GET /event/1/timetable/pdf?visible_entries=showContribsAtConfLevel&visible_entries=showBreaksAtConfLevel&pagesize=A4&session_info=useSessionColorCodes&session_info=showSessionDescription&document_settings=showCoverPage&document_set
tings=showTableContents&document_settings=showSessionTOC&submitted=&firstPageNumber=1&contribution_info=showContribId&contribution_info=showAbstract&download=1&advanced=y [IP=10.0.3.1] [PID=13430] [UID=1]
2021-04-19 11:20:52,893  ERROR    9773cea304d44646  indico.flask              Flowable <Table@0x7FCA0B097EA8 1 rows x 3 cols(tallest row 4042)> with cell(0,0) containing
' '(526.582677165 x 4042), tallest cell 4042.0 points,  too large on page 2 in frame 'normal'(526.582677165 x 773.196850394*) of template 'Later'
Traceback (most recent call last):
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/web/flask/util.py", line 84, in wrapper
    return obj().process()
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/web/rh.py", line 275, in process
    res = self._do_process()
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/modules/events/controllers/base.py", line 54, in _do_process
    return RHEventBase._do_process(self)
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/web/rh.py", line 245, in _do_process
    rv = self._process()
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/modules/events/timetable/controllers/display.py", line 87, in _process
    return send_file('timetable.pdf', BytesIO(pdf.getPDFBin()), 'application/pdf')
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/legacy/pdfinterface/base.py", line 641, in getPDFBin
    self._doc.multiBuild(self._story, onFirstPage=self.firstPage, onLaterPages=self.laterPages)
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/legacy/pdfinterface/base.py", line 550, in multiBuild
    SimpleDocTemplate.multiBuild(self, story, maxPasses, canvasmaker=canvasMaker)
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/reportlab/platypus/doctemplate.py", line 1144, in multiBuild
    self.build(tempStory, **buildKwds)
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/reportlab/platypus/doctemplate.py", line 1292, in build
    BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker)
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/reportlab/platypus/doctemplate.py", line 1057, in build
    self.handle_flowable(flowables)
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/reportlab/platypus/doctemplate.py", line 942, in handle_flowable
    raise LayoutError(ident)
LayoutError: Flowable <Table@0x7FCA0B097EA8 1 rows x 3 cols(tallest row 4042)> with cell(0,0) containing
' '(526.582677165 x 4042), tallest cell 4042.0 points,  too large on page 2 in frame 'normal'(526.582677165 x 773.196850394*) of template 'Later'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants