fix to patch

This commit is contained in:
Rushabh Mehta 2012-02-03 13:36:49 +05:30
parent f5d4218d3d
commit 9f8f5fce19
2 changed files with 7 additions and 15 deletions

View file

@ -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):

14
wnf.py
View file

@ -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)