Merge lp:~camptocamp/openobject-addons/bug_6349 into lp:openobject-addons

Proposed by Nicolas Bessi - Camptocamp
Status: Work in progress
Proposed branch: lp:~camptocamp/openobject-addons/bug_6349
Merge into: lp:openobject-addons
Diff against target: 24 lines (+5/-2)
1 file modified
report_webkit/webkit_report.py (+5/-2)
To merge this branch: bzr merge lp:~camptocamp/openobject-addons/bug_6349
Reviewer Review Type Date Requested Status
Raphael Collet (OpenERP) (community) Needs Fixing
Alexandre Fayolle - camptocamp (community) abstain Needs Fixing
Olivier Dony (Odoo) Pending
Review via email: mp+88689@code.launchpad.net

Description of the change

Fix of bug 904363

To post a comment you must log in.
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

The orginal code would check for the existance of the file, which the new version does not do : tools.file_open raises an IOError exception if the path is not found, I think the code should check for that exception.

The "if template_file:" test will always be true, as there is no way that tools.file_open can return something evaluating to False (as said above, it will fail with an exception).

review: Needs Fixing (abstain)
Revision history for this message
Raphael Collet (OpenERP) (rco-openerp) wrote :

+1 on the comment of Alexandre above

review: Needs Fixing

Unmerged revisions

6349. By Nicolas Bessi - Camptocamp

[FIX] bug no 904363

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'report_webkit/webkit_report.py'
2--- report_webkit/webkit_report.py 2012-01-09 20:13:53 +0000
3+++ report_webkit/webkit_report.py 2012-01-16 13:44:25 +0000
4@@ -36,6 +36,7 @@
5 import tempfile
6 import time
7 import logging
8+import tools
9
10 from mako.template import Template
11 from mako.lookup import TemplateLookup
12@@ -214,8 +215,10 @@
13
14 if report_xml.report_file :
15 path = addons.get_module_resource(report_xml.report_file)
16- if os.path.exists(path) :
17- template = file(path).read()
18+ # we do this in order to support zip report modules seems deprecated in trunk
19+ template_file = tools.file_open(path) # with syntax would be nice
20+ if template_file:
21+ template = template_file.read()
22 if not template and report_xml.report_webkit_data :
23 template = report_xml.report_webkit_data
24 if not template :

Subscribers

People subscribed via source and target branches

to all changes: