Relatorio

Bug 51

classification
Title: error raised when generating warning
Type: crash Severity: normal
Components: opendocument Versions:
process
Status: new Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: uha4
Priority: normal Keywords:

Created on 2019-04-13 19:43 by uha4, last changed 2019-04-13 19:54 by uha4.

Messages
msg97 Author: [hidden] (uha4) Date: 2019-04-13 19:43
when playing with reports in tryton, an error was raised out
of relatorio:

"""
File
"/usr/lib/python3/dist-packages/relatorio/templates/opendocument.py",
line 294, in _parse
  content = template._parse(self.insert_directives(content),
encoding)
File
"/usr/lib/python3/dist-packages/relatorio/templates/opendocument.py",
line 347, in insert_directives
  self._handle_relatorio_tags(tree)
File
"/usr/lib/python3/dist-packages/relatorio/templates/opendocument.py",
line 460, in _handle_relatorio_tags
  r_statements, closing_tags = self._relatorio_statements(tree)
File
"/usr/lib/python3/dist-packages/relatorio/templates/opendocument.py",
line 416, in _relatorio_statements
  % opened_tags[-1].text

builtins.AttributeError: 'tuple' object has no attribute 'text'
"""

so i looked with the debugger and in the source: opened_tags
is a list of tuples. So i guess this line 416 has to be "  %
opened_tags[-1][].text" accessing the .text element of the
firt component of the tuple.
If i change it like that, there is no more Error, but the
warning is printed this line is supposed to generate.
msg98 Author: [hidden] (uha4) Date: 2019-04-13 19:54
OOps there was a typo:

The changed line 416 should be:
"  %opened_tags[-1][0].text"

by the way i use the current version of relatorio as
installed with pip3. But the code looks exactly the same in
the development version:
https://hg.tryton.org/relatorio/file/tip/relatorio/templates/opendocument.py
History
Date User Action Args
2019-04-13 19:54:23uha4setmessages: + msg98
2019-04-13 19:43:34uha4create