ajeebkp23 / python-relatorio

Automatically exported from code.google.com/p/python-relatorio. Thus it enables to to install this package via pip.
GNU General Public License v3.0
0 stars 0 forks source link

Nested loops handling #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Entering a nested loop in an ODT template such as:
<for each="key, val_list in obj.iteritems">
<key> : <for each="val in val_list><_val>
</for>
</for>

(line-breaks positioning is important to reproduce)

What is the expected output?

Expected output:
key1 : val1
val2
val3
key2 : valx...

What do you see instead?
Nothing

What version of the product are you using? On what operating system?
relatorio 0.5.6 from Debian's package python-relatorio 0.5.6-2 (wheezy)

Please provide any additional information below.
Changing the position of the line breaks changes the *text* of the output.

Original issue reported on code.google.com by laur...@bioecoforests.com on 8 Jul 2013 at 4:54

GoogleCodeExporter commented 9 years ago
Without the typos, the code reads:
<for each="key, val_list in obj.iteritems()">
<key> : <for each="val in val_list"><val>
</for>
</for>

Original comment by laur...@bioecoforests.com on 8 Jul 2013 at 4:56

GoogleCodeExporter commented 9 years ago
lines with statements are removed after processing.
So I think you should write something like:

<for each="key, val_list in obj.iteritems()">
<key> : <val_list[1]>
<for each="val in val_list[1:]">
<val>
</for>
</for>

Original comment by cedric.krier@b2ck.com on 9 Jul 2013 at 12:22

GoogleCodeExporter commented 9 years ago
Indeed, the work-around works.

Original comment by laur...@bioecoforests.com on 10 Jul 2013 at 12:44

GoogleCodeExporter commented 9 years ago
Could you provide the raw XML of the odt?

Original comment by cedric.krier@b2ck.com on 10 Jul 2013 at 1:48

GoogleCodeExporter commented 9 years ago
See the test.odt file attached.

The templates expects a dictionnary of the form:

objects = [{
    'dict': {
        '1': ['a', 'b', 'c'],
        '2': ['a', 'b', 'c'],
    }
}]

Original comment by laur...@bioecoforests.com on 10 Jul 2013 at 2:32

Attachments:

GoogleCodeExporter commented 9 years ago
As we have to generate valid XML, we have to remove the genshi instruction from 
within the first common ancestor between the starting instruction and the 
closing.
So it impossible to support your case.

Original comment by cedric.krier@b2ck.com on 10 Jul 2013 at 2:53