change from labels to fieldname in cur_frm.cscript

This commit is contained in:
Anand Doshi
2012-04-05 13:03:35 +05:30
parent 130dfaee8c
commit fa0cd89a7c
204 changed files with 389 additions and 1663 deletions

7
wnf.py
View File

@@ -18,9 +18,12 @@
import os, sys
def replace_code(start, txt1, txt2, extn):
def replace_code(start, txt1, txt2, extn, search=None):
"""replace all txt1 by txt2 in files with extension (extn)"""
import webnotes.utils
import os, re
esc = webnotes.utils.make_esc('[]')
if not search: search = esc(txt1)
for wt in os.walk(start, followlinks=1):
for fn in wt[2]:
if fn.split('.')[-1]==extn:
@@ -29,7 +32,7 @@ def replace_code(start, txt1, txt2, extn):
with open(fpath, 'r') as f:
content = f.read()
if re.search(txt1, content):
if re.search(search, content):
res = search_replace_with_prompt(fpath, txt1, txt2)
if res == 'skip':
return 'skip'