gateway patch
This commit is contained in:
parent
1b1179477b
commit
7c76f80966
@ -23,17 +23,23 @@ def execute():
|
|||||||
txt = get_file_id(txt)
|
txt = get_file_id(txt)
|
||||||
|
|
||||||
webnotes.conn.sql("""update `tab%s` set %s=%s where name=%s""" % \
|
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
|
# control panel, client name
|
||||||
txt = webnotes.conn.get_value('Control Panel',None,'client_name')
|
txt = webnotes.conn.get_value('Control Panel',None,'client_name')
|
||||||
txt = get_file_id(txt)
|
if txt:
|
||||||
webnotes.conn.set_value('Control Panel', None, 'client_name', txt.replace('index.cgi?cmd=get_file&fname=', 'files/'))
|
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):
|
def get_file_id(txt):
|
||||||
"""old file links may be from fileid or filename"""
|
"""old file links may be from fileid or filename"""
|
||||||
import re
|
import re
|
||||||
match = re.search('files/([^"\']*)', txt)
|
match = re.search('files/([^"\']*)', txt)
|
||||||
|
|
||||||
|
if not match:
|
||||||
|
print txt
|
||||||
|
return txt
|
||||||
|
|
||||||
fname = match.groups()[0]
|
fname = match.groups()[0]
|
||||||
if not fname.startswith('FileData'):
|
if not fname.startswith('FileData'):
|
||||||
fid = webnotes.conn.sql("""select name from `tabFile Data`
|
fid = webnotes.conn.sql("""select name from `tabFile Data`
|
||||||
@ -41,4 +47,4 @@ def get_file_id(txt):
|
|||||||
if fid:
|
if fid:
|
||||||
fid = fid[0][0].replace('/', '-')
|
fid = fid[0][0].replace('/', '-')
|
||||||
txt = txt.replace(fname, fid)
|
txt = txt.replace(fname, fid)
|
||||||
return txt
|
return txt
|
||||||
|
@ -7,7 +7,7 @@ def on_login(login_manager):
|
|||||||
"""
|
"""
|
||||||
called from login manager, before login
|
called from login manager, before login
|
||||||
"""
|
"""
|
||||||
if login_manager.user not in ('Guest', None, ''):
|
if login_manager.user not in ('Guest', None, '') and webnotes.conn.cur_db_name!='accounts' and webnotes.conn.get_value('Control Panel', 'Control Panel', 'account_id')!='s5u011':
|
||||||
try:
|
try:
|
||||||
login_manager = login_as(login_manager)
|
login_manager = login_as(login_manager)
|
||||||
update_account_details()
|
update_account_details()
|
||||||
@ -32,7 +32,7 @@ def on_login_post_session(login_manager):
|
|||||||
sid!=%s""", \
|
sid!=%s""", \
|
||||||
(webnotes.session['user'], webnotes.session['sid']), as_list=1)
|
(webnotes.session['user'], webnotes.session['sid']), as_list=1)
|
||||||
|
|
||||||
if webnotes.session['user'] not in ('Guest'):
|
if webnotes.session['user'] not in ('Guest') and webnotes.conn.cur_db_name!='accounts':
|
||||||
# create feed
|
# create feed
|
||||||
from webnotes.utils import nowtime
|
from webnotes.utils import nowtime
|
||||||
home.make_feed('Login', 'Profile', login_manager.user, login_manager.user,
|
home.make_feed('Login', 'Profile', login_manager.user, login_manager.user,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user