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)

[IMP] Don't even bother with savepoints

6. By Stefan Rijnhart (Opener)

[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
=== modified file 'report_aeroo/report_xml.py'
--- report_aeroo/report_xml.py 2013-05-16 15:53:25 +0000
+++ report_aeroo/report_xml.py 2013-12-29 20:11:08 +0000
@@ -233,13 +233,12 @@
233 helper_installed = helper_module and helper_module['state']=='installed'233 helper_installed = helper_module and helper_module['state']=='installed'
234234
235 if OpenOffice_service and helper_installed:235 if OpenOffice_service and helper_installed:
236 cr.execute("SELECT host, port FROM oo_config")
237 host, port = cr.fetchone()
238 try:236 try:
237 cr.execute("SELECT host, port FROM oo_config")
238 host, port = cr.fetchone()
239 OpenOffice_service(cr, host, port)239 OpenOffice_service(cr, host, port)
240 netsvc.Logger().notifyChannel('report_aeroo', netsvc.LOG_INFO, "OpenOffice.org connection successfully established")240 netsvc.Logger().notifyChannel('report_aeroo', netsvc.LOG_INFO, "OpenOffice.org connection successfully established")
241 except Exception, e:241 except Exception, e:
242 cr.rollback()
243 netsvc.Logger().notifyChannel('report_aeroo', netsvc.LOG_WARNING, str(e))242 netsvc.Logger().notifyChannel('report_aeroo', netsvc.LOG_WARNING, str(e))
244 ##############################################243 ##############################################
245244

Subscribers

People subscribed via source and target branches