From 9f8f5fce1984bec424be40e9f17ca7a4cc06e4aa Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 3 Feb 2012 13:36:49 +0530 Subject: [PATCH] fix to patch --- py/webnotes/modules/patch_handler.py | 8 ++++++-- wnf.py | 14 +------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/py/webnotes/modules/patch_handler.py b/py/webnotes/modules/patch_handler.py index 822671e22c..5812aa07c3 100644 --- a/py/webnotes/modules/patch_handler.py +++ b/py/webnotes/modules/patch_handler.py @@ -53,7 +53,11 @@ def execute_patch(patchmodule, method=None, methodargs=None): has_errors = True tb = webnotes.getTraceback() log(tb) - add_to_patch_log(tb) + import os + if os.environ.get('HTTP_HOST'): + add_to_patch_log(tb) + else: + print tb block_user(False) @@ -61,7 +65,7 @@ def execute_patch(patchmodule, method=None, methodargs=None): def add_to_patch_log(tb): """add error log to patches/patch.log""" import webnotes.defs, os - with open(os.path.join(webnotes.defs.modules_path,'patches','patch.log'),'a') as patchlog: + with open(os.path.join(webnotes.defs.modules_path,'erpnext','patches','patch.log'),'a') as patchlog: patchlog.write('\n\n' + tb) def update_patch_log(patchmodule): diff --git a/wnf.py b/wnf.py index e27530bde2..f031ca58f1 100755 --- a/wnf.py +++ b/wnf.py @@ -2,18 +2,6 @@ import os, sys -def print_help(): - print "wnframework version control utility" - print - print "Usage:" - print "python lib/wnf.py build : scan all folders and commit versions with latest changes" - print "python lib/wnf.py pull : pull from git" - print "python lib/wnf.py replace txt1 txt2 extn" - print "python lib/wnf.py patch patch1 .. : run patches from patches module if not executed" - print "python lib/wnf.py patch -f patch1 .. : run patches from patches module, force rerun" - -"""simple replacement script""" - def replace_code(start, txt1, txt2, extn): """replace all txt1 by txt2 in files with extension (extn)""" import os, re @@ -112,7 +100,7 @@ def run(): # patch - elif options.patch: + elif options.patch_list: # connect to db if options.db_name is not None: webnotes.connect(options.db_name)