Relatorio

Bug 51

classification
Title: error raised when generating warning
Type: crash Severity: normal
Components: opendocument Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: ced Nosy List: ced, roundup-bot, uha4
Priority: normal Keywords:

Created on 2019-04-13 19:43 by uha4, last changed 2019-07-29 15:58 by roundup-bot.

Messages
msg97 (view) 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 (view) 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
msg99 (view) Author: [hidden] (ced) Date: 2019-04-28 13:34
Here is review269431002 which should fix the issue and add
tests.
msg101 (view) Author: [hidden] (roundup-bot) Date: 2019-07-29 15:29
New changeset dac0dd4000b0 by Cédric Krier in branch 'default':
Do not fail when warn about text statement
https://hg.tryton.org/public/relatorio/rev/dac0dd4000b0
msg102 (view) Author: [hidden] (roundup-bot) Date: 2019-07-29 15:53
New changeset 7bb98a377235 by Cédric Krier in branch 'default':
Do not fail when warn about text statement
https://hg.tryton.org/public/relatorio/rev/7bb98a377235
msg103 (view) Author: [hidden] (roundup-bot) Date: 2019-07-29 15:58
New changeset 7bb98a377235 by Cédric Krier in branch 'default':
Do not fail when warn about text statement
https://hg.tryton.org/relatorio/rev/7bb98a377235
History
Date User Action Args
2019-07-29 15:58:11roundup-botsetstatus: pending -> closed
messages: + msg103
2019-07-29 15:53:31roundup-botsetmessages: + msg102
2019-07-29 15:29:01roundup-botsetstatus: open -> pending
nosy: + roundup-bot
messages: + msg101
2019-04-28 13:34:38cedsetstatus: new -> open
assignee: ced
messages: + msg99
nosy: + ced
2019-04-13 19:54:23uha4setmessages: + msg98
2019-04-13 19:43:34uha4create