rendering mako template to html to generate a report will fail
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
New
|
Undecided
|
Unassigned |
Bug Description
In makohtml2html.py
def format_body(self, html):
body = html.findall(
body_list = []
footer = self.format_
for b in body[:-1]:
【Description above in English 】
Here, because for a html file, it should be only have 1 body tag, so in for loop statement, body[:-1] will return a null list.
I think, this way of parsing mako template parser is wrong. and it needs a better parsing method.
while my mako templates as below,
# -*- coding: utf-8 -*-
<html>
% for o in objects:
<body>
<table>number: 1
</table>
</body>
% endfor
</html>
there always report a Error:
2014-02-17 15:32:15,246 4228 ERROR openerp.
Traceback (most recent call last):
File "D:\openerp-
final_html += self.format_
File "D:\openerp-
footer = self.format_
File "D:\openerp-
for node in footer[
IndexError: list index out of range
2014-02-17 15:32:15,250 4228 ERROR openerp.netsvc: RML is not available at specified location or not enough data to print!
(None, None, None)
but if add "head" and another "body" with "footer", above error will disappear, but for a html file, multi "body" tag is fault, too.
# -*- coding: utf-8 -*-
<html>
<head>
</head>
% for o in objects:
<body>
<table>number: 1
</table>
</body>
% endfor
<body>
<footer></footer>
</body>
</html>
So please help me to clear it.
thx.