From 2fefadd97662c89bce32eb0bb359ecd4f255d8a4 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 9 Jun 2014 17:53:51 +0530 Subject: [PATCH] Re-raise error in patch handler --- frappe/modules/patch_handler.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/frappe/modules/patch_handler.py b/frappe/modules/patch_handler.py index e7dbd01ff5..bc6f8a0aa1 100644 --- a/frappe/modules/patch_handler.py +++ b/frappe/modules/patch_handler.py @@ -53,9 +53,9 @@ def run_single(patchmodule=None, method=None, methodargs=None, force=False): def execute_patch(patchmodule, method=None, methodargs=None): """execute the patch""" - success = False block_user(True) frappe.db.begin() + try: log('Executing {patch} in {site} ({db})'.format(patch=patchmodule or str(methodargs), site=frappe.local.site, db=frappe.db.cur_db_name)) @@ -68,17 +68,16 @@ def execute_patch(patchmodule, method=None, methodargs=None): elif method: method(**methodargs) - frappe.db.commit() - success = True - except Exception, e: + except Exception: frappe.db.rollback() - tb = frappe.get_traceback() - log(tb) + raise - block_user(False) - if success: + else: + frappe.db.commit() + block_user(False) log('Success') - return success + + return True def update_patch_log(patchmodule): """update patch_file in patch log"""