euphorie / Euphorie

Euphorie is a tool for risk assessment
https://pythonhosted.org/Euphorie/
GNU General Public License v2.0
11 stars 6 forks source link

AttributeError raised when creating a report #688

Closed ale-rt closed 5 months ago

ale-rt commented 6 months ago

We spotted this error:

  Module euphorie.client.docx.compiler, line 350, in add_report_section
  Module euphorie.client.docx.html, line 133, in __call__
  Module euphorie.client.docx.html, line 113, in handleElement
AttributeError: 'Document' object has no attribute 'text'

Apparently, the doc instance has no textattribute.

(Pdb++) doc
<docx.document.Document object at 0x7fbc11f17500>
(Pdb++) doc.text
*** AttributeError: 'Document' object has no attribute 'text'

text appears to be an attribute of the Paragraph objects.

(Pdb++) !p
<docx.text.paragraph.Paragraph object at 0x7fbc0a419a00>
(Pdb++) !p.text
'Het registreren ...'
ale-rt commented 6 months ago

The problem is with this line:

If my analysis is correct, the problem in this line: https://github.com/euphorie/Euphorie/blob/49cb42d61da2caba93bc937737eeb68c837e8ae6/src/euphorie/client/docx/html.py#L113

My idea is that we did not see it before because tail was never true, so the second part of the if was never reached.