replace_code fn updated
This commit is contained in:
parent
3ffca32ace
commit
19ee00b989
16
wnf.py
16
wnf.py
@ -25,11 +25,12 @@ def replace_code(start, txt1, txt2, extn):
|
|||||||
for fn in wt[2]:
|
for fn in wt[2]:
|
||||||
if fn.split('.')[-1]==extn:
|
if fn.split('.')[-1]==extn:
|
||||||
fpath = os.path.join(wt[0], fn)
|
fpath = os.path.join(wt[0], fn)
|
||||||
with open(fpath, 'r') as f:
|
if fpath != '/var/www/erpnext/erpnext/patches/jan_mar_2012/rename_dt.py': # temporary
|
||||||
content = f.read()
|
with open(fpath, 'r') as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
if re.search(txt1, content):
|
if re.search(txt1, content):
|
||||||
search_replace_with_prompt(fpath, txt1, txt2)
|
search_replace_with_prompt(fpath, txt1, txt2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -45,9 +46,10 @@ def search_replace_with_prompt(fpath, txt1, txt2):
|
|||||||
if c.find(txt1) != -1:
|
if c.find(txt1) != -1:
|
||||||
print '\n', fpath
|
print '\n', fpath
|
||||||
print colored(txt1, 'red').join(c[:-1].split(txt1))
|
print colored(txt1, 'red').join(c[:-1].split(txt1))
|
||||||
|
a = ''
|
||||||
a = raw_input('Do you want to Change [y/n]?')
|
while a not in ['y', 'n', 'Y', 'N']:
|
||||||
if a=='y':
|
a = raw_input('Do you want to Change [y/n]?')
|
||||||
|
if a.lower() == 'y':
|
||||||
c = c.replace(txt1, txt2)
|
c = c.replace(txt1, txt2)
|
||||||
tmp.append(c)
|
tmp.append(c)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user