Merge lp:~therp-nl/aeroo/7.0-lp1259995-no_rollback_in_register_all into lp:aeroo

Proposed by Stefan Rijnhart (Opener)
Status: Needs review
Proposed branch: lp:~therp-nl/aeroo/7.0-lp1259995-no_rollback_in_register_all
Merge into: lp:aeroo
Diff against target: 18 lines (+2/-3)
1 file modified
report_aeroo/report_xml.py (+2/-3)
To merge this branch: bzr merge lp:~therp-nl/aeroo/7.0-lp1259995-no_rollback_in_register_all
Reviewer Review Type Date Requested Status
Alistek developers - http://www.alistek.com Pending
Review via email: mp+200153@code.launchpad.net

Commit message

[FIX] Rollback in register_all leads to information loss

Description of the change

The cursor rollback in report_xml::register_all() undoes the calculation of the parent store columns after module initialization, as it's called in the same transaction.

The rollback is called in a try/catch block that detects if an OpenOffice connection can be established. My first version of the fix featured a savepoint to perform the rollback. This worked, but after a closer look I noticed there does not actually seem to be any cursor interaction in this part that would warrant the rollback so I did away with the savepoint too.

I could not help noticing the assumption in the same block of code that the oo_config table is assumed to have at least one row. I put this in the try/catch block to prevent any problems at this point, even if it is unrelated to the rollback problem.

On the side, note that the constructor that the method arguments are passed on to ignores the arguments and fetches them again from the oo_config table. I left this because I did not know if there could be compatibility problems with older versions of the ooo module if I removed the redundant arguments.

To post a comment you must log in.

Unmerged revisions

7. By Stefan Rijnhart (Opener) on 2013-12-29

[IMP] Don't even bother with savepoints

6. By Stefan Rijnhart (Opener) on 2013-12-29

[FIX] Rollback in register_all leads to information loss

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'report_aeroo/report_xml.py'
2--- report_aeroo/report_xml.py 2013-05-16 15:53:25 +0000
3+++ report_aeroo/report_xml.py 2013-12-29 20:11:08 +0000
4@@ -233,13 +233,12 @@
5 helper_installed = helper_module and helper_module['state']=='installed'
6
7 if OpenOffice_service and helper_installed:
8- cr.execute("SELECT host, port FROM oo_config")
9- host, port = cr.fetchone()
10 try:
11+ cr.execute("SELECT host, port FROM oo_config")
12+ host, port = cr.fetchone()
13 OpenOffice_service(cr, host, port)
14 netsvc.Logger().notifyChannel('report_aeroo', netsvc.LOG_INFO, "OpenOffice.org connection successfully established")
15 except Exception, e:
16- cr.rollback()
17 netsvc.Logger().notifyChannel('report_aeroo', netsvc.LOG_WARNING, str(e))
18 ##############################################
19

Subscribers

People subscribed via source and target branches