Rushabh Mehta | 3966f1d | 2012-02-23 12:35:32 +0530 | [diff] [blame] | 1 | # 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 Vyas | c1e6e4c | 2011-06-08 14:37:15 +0530 | [diff] [blame] | 17 | import os |
| 18 | |
| 19 | def 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 | |
| 31 | if __name__=='__main__': |
nabinhait | 1bd56b1 | 2011-07-05 14:41:36 +0530 | [diff] [blame] | 32 | old = """cur_frm.cscript.get_tips(doc, cdt, cdn);""" |
nabinhait | c297df5 | 2011-07-05 10:54:05 +0530 | [diff] [blame] | 33 | new = " " |
Pratik Vyas | c1e6e4c | 2011-06-08 14:37:15 +0530 | [diff] [blame] | 34 | replace_code(old, new) |
nabinhait | c297df5 | 2011-07-05 10:54:05 +0530 | [diff] [blame] | 35 | |