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"""