Merge lp://staging/~camptocamp/ocb-addons/7.0-fix-1319095 into lp://staging/ocb-addons

Proposed by Yannick Vaucher @ Camptocamp
Status: Merged
Approved by: Leonardo Pistone
Approved revision: no longer in the source branch.
Merged at revision: 10208
Proposed branch: lp://staging/~camptocamp/ocb-addons/7.0-fix-1319095
Merge into: lp://staging/ocb-addons
Diff against target: 74 lines (+15/-25)
1 file modified
report_webkit/webkit_report.py (+15/-25)
To merge this branch: bzr merge lp://staging/~camptocamp/ocb-addons/7.0-fix-1319095
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza code review Approve
Alexandre Fayolle - camptocamp code review, no test Approve
Nicolas Bessi - Camptocamp (community) no test, code review Approve
Florent Pending
Review via email: mp+219476@code.staging.launchpad.net

Description of the change

Use NamedTemporaryFile instead of file and of deprecated mktemp. That way we ensure 2 files created at the exact same time will have a unique name

Another hot fix from Florent was made here https://code.launchpad.net/~florent.x/openobject-addons/trunk-1290820-report_webkit/+merge/210387

I believe this one is a bit cleaner as it refactor a bit the code. However it doesn't keep timestamp in file name. But do we need timestamp in file name ?

If so I can still add it in prefix or suffix.

To post a comment you must log in.
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Thanks for the fix.

LGTM

This patch will not be backportable as is to version 6.1, 6.0 as it is not Python 2.5 compliant

Regards

Nicolas

review: Approve (no test, code review)
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

This fix will not work on Windows.

out_filename is opened on line 11 of the file, and then the pdf converter will try to open a file with the same name while the file is still open in OpenERP which will fail on windows (https://docs.python.org/2.7/library/tempfile.html?highlight=namedtemporaryfile#tempfile.NamedTemporaryFile)

review: Needs Fixing (code review, no test)
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Good catch

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Thanks for the review and the explanations.

This has been fixed.

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

LGTM

review: Approve (code review, no test)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

LGTM.

Regards.

review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.