Fix SELECT Script option for functions. Fixes #1191

This commit is contained in:
Sanket Mehta 2016-06-21 13:29:55 +01:00 committed by Dave Page
parent 980ab4735e
commit 03d348f7c2

View File

@ -1244,16 +1244,18 @@ It may have been removed by another user or moved to another schema.
func_def, name = res['rows'][0]
# Fetch only arguments
args = name[name.rfind('('):].strip('(').strip(')').split(',')
# Remove unwanted spaces from arguments
args = [arg.strip(' ') for arg in args]
argString = name[name.rfind('('):].strip('(').strip(')')
if len(argString) > 0:
args = argString.split(',')
# Remove unwanted spaces from arguments
args = [arg.strip(' ') for arg in args]
# Remove duplicate and then format arguments
for arg in list(set(args)):
formatted_arg = '\n\t<' + arg + '>'
name = name.replace(arg, formatted_arg)
# Remove duplicate and then format arguments
for arg in list(set(args)):
formatted_arg = '\n\t<' + arg + '>'
name = name.replace(arg, formatted_arg)
name = name.replace(')', '\n)')
name = name.replace(')', '\n)')
sql = "SELECT {0}".format(name)
return ajax_response(response=sql)