diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-04-14 12:27:43 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-04-14 12:38:51 +0200 |
| commit | ea2faefe0d6a4a6063d48fc2cda8d7071d9eefa4 (patch) | |
| tree | 7fe2bcf6ede99f9b0591679f014ea47fc5a46245 | |
| parent | 31dc6b888eeb2d787f567562fb447e8131c877e3 (diff) | |
[FIX] odoo-bin shell: force rollback on exit
Each REPL python shell behave differently depending on the exit method.
Force a rollback at the end to avoid inconsitent behavior.
Thanks to Harry Jollenbeck for the report: https://www.odoo.com/groups/59/26318707
| -rw-r--r-- | odoo/cli/shell.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/odoo/cli/shell.py b/odoo/cli/shell.py index 6d0b0d5bd01..1e847800956 100644 --- a/odoo/cli/shell.py +++ b/odoo/cli/shell.py @@ -14,6 +14,25 @@ from . import Command _logger = logging.getLogger(__name__) +""" + Shell exit behaviors + ==================== + + Legend: + stop = The REPL main loop stop. + raise = Exception raised. + loop = Stay in REPL. + + Shell | ^D | exit() | quit() | sys.exit() | raise SystemExit() +---------------------------------------------------------------------- + python | stop | raise | raise | raise | raise + ipython | stop | stop | stop | loop | loop + ptpython | stop | raise | raise | raise | raise + bpython | stop | stop | stop | stop | stop + +""" + + def raise_keyboard_interrupt(*a): raise KeyboardInterrupt() @@ -95,6 +114,7 @@ class Shell(Command): local_vars['env'] = env local_vars['self'] = env.user self.console(local_vars) + cr.rollback() else: self.console(local_vars) |
