Browse Source

Merge pull request #266 from hbrunn/6.1-fetchmail_attach_from_folder-disable_rollbacks

[FIX] disable rollbacks in matching code
6.1
Moises Lopez - https://www.vauxoo.com/ 9 years ago
parent
commit
5dca138817
  1. 7
      fetchmail_attach_from_folder/model/fetchmail_server.py

7
fetchmail_attach_from_folder/model/fetchmail_server.py

@ -150,17 +150,22 @@ class fetchmail_server(Model):
folder.match_first):
try:
cr.execute('savepoint apply_matching')
# OpenERP 6.1 does a rollback on validation errors
rollback_org = cr.rollback
cr.rollback = lambda: None
match_algorithm.handle_match(
cr, uid, connection,
found_ids[0], folder, mail_message,
msgdata[0][1], msgid, context)
cr.rollback = rollback_org
cr.execute('release savepoint apply_matching')
matched_object_ids += found_ids[:1]
except Exception:
cr.execute('rollback to savepoint apply_matching')
logger.exception(
"Failed to fetch mail %s from %s",
msgid, this.name)
cr.rollback = rollback_org
cr.execute('rollback to savepoint apply_matching')
elif folder.flag_nonmatching:
connection.store(msgid, '+FLAGS', '\\FLAGGED')

Loading…
Cancel
Save