change from labels to fieldname in cur_frm.cscript
diff --git a/wnf.py b/wnf.py
index 4cd1c8b..ad450cd 100755
--- a/wnf.py
+++ b/wnf.py
@@ -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 @@
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'