blob: 0043f9c7ff7c4324968d6f68fe576431c6de540d [file] [log] [blame]
Rushabh Mehta3966f1d2012-02-23 12:35:32 +05301# ERPNext - web based ERP (http://erpnext.com)
2# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
Pratik Vyasc1e6e4c2011-06-08 14:37:15 +053017import os
18
19def replace_code(old, new):
20 txt = os.popen("""grep "%s" ./*/*/*/*.js""" % old).read().split()
21 txt = [t.split(':')[0] for t in txt]
22 txt = list(set(filter(lambda t: t.startswith('./'), txt)))
23 for t in txt:
24 if new:
25 code = open(t,'r').read().replace(old, new)
26 open(t, 'w').write(code)
27 print "Replaced for %s" % t
28 else:
29 print 'Found in %s' % t
30
31if __name__=='__main__':
nabinhait1bd56b12011-07-05 14:41:36 +053032 old = """cur_frm.cscript.get_tips(doc, cdt, cdn);"""
nabinhaitc297df52011-07-05 10:54:05 +053033 new = " "
Pratik Vyasc1e6e4c2011-06-08 14:37:15 +053034 replace_code(old, new)
nabinhaitc297df52011-07-05 10:54:05 +053035