gateway patch

This commit is contained in:
Rushabh Mehta
2012-02-16 10:58:45 +01:00
parent 1b1179477b
commit 7c76f80966
2 changed files with 13 additions and 7 deletions

View File

@@ -23,17 +23,23 @@ def execute():
txt = get_file_id(txt)
webnotes.conn.sql("""update `tab%s` set %s=%s where name=%s""" % \
(table[0], table[1], '%s', '%s'), (txt, item[0]), debug=1)
(table[0], table[1], '%s', '%s'), (txt, item[0]))
# control panel, client name
txt = webnotes.conn.get_value('Control Panel',None,'client_name')
txt = get_file_id(txt)
webnotes.conn.set_value('Control Panel', None, 'client_name', txt.replace('index.cgi?cmd=get_file&fname=', 'files/'))
if txt:
txt = get_file_id(txt)
webnotes.conn.set_value('Control Panel', None, 'client_name', txt.replace('index.cgi?cmd=get_file&fname=', 'files/'))
def get_file_id(txt):
"""old file links may be from fileid or filename"""
import re
match = re.search('files/([^"\']*)', txt)
if not match:
print txt
return txt
fname = match.groups()[0]
if not fname.startswith('FileData'):
fid = webnotes.conn.sql("""select name from `tabFile Data`
@@ -41,4 +47,4 @@ def get_file_id(txt):
if fid:
fid = fid[0][0].replace('/', '-')
txt = txt.replace(fname, fid)
return txt
return txt