Merge pull request #2151 from leonelcamara/patch-30
Teach admin how to deal with syntax errors
This commit is contained in:
@@ -814,8 +814,11 @@ def edit():
|
|||||||
|
|
||||||
if len(request.args) > 2 and request.args[1] == 'controllers':
|
if len(request.args) > 2 and request.args[1] == 'controllers':
|
||||||
controller = (request.args[2])[:-3]
|
controller = (request.args[2])[:-3]
|
||||||
functions = find_exposed_functions(data)
|
try:
|
||||||
functions = functions and sorted(functions) or []
|
functions = find_exposed_functions(data)
|
||||||
|
functions = functions and sorted(functions) or []
|
||||||
|
except SyntaxError as err:
|
||||||
|
functions = ['SyntaxError:Line:%d' % err.lineno]
|
||||||
else:
|
else:
|
||||||
(controller, functions) = (None, None)
|
(controller, functions) = (None, None)
|
||||||
|
|
||||||
@@ -1127,8 +1130,11 @@ def design():
|
|||||||
functions = {}
|
functions = {}
|
||||||
for c in controllers:
|
for c in controllers:
|
||||||
data = safe_read(apath('%s/controllers/%s' % (app, c), r=request))
|
data = safe_read(apath('%s/controllers/%s' % (app, c), r=request))
|
||||||
items = find_exposed_functions(data)
|
try:
|
||||||
functions[c] = items and sorted(items) or []
|
items = find_exposed_functions(data)
|
||||||
|
functions[c] = items and sorted(items) or []
|
||||||
|
except SyntaxError as err:
|
||||||
|
functions[c] = ['SyntaxError:Line:%d' % err.lineno]
|
||||||
|
|
||||||
# Get all views
|
# Get all views
|
||||||
views = sorted(
|
views = sorted(
|
||||||
@@ -1265,8 +1271,11 @@ def plugin():
|
|||||||
functions = {}
|
functions = {}
|
||||||
for c in controllers:
|
for c in controllers:
|
||||||
data = safe_read(apath('%s/controllers/%s' % (app, c), r=request))
|
data = safe_read(apath('%s/controllers/%s' % (app, c), r=request))
|
||||||
items = find_exposed_functions(data)
|
try:
|
||||||
functions[c] = items and sorted(items) or []
|
items = find_exposed_functions(data)
|
||||||
|
functions[c] = items and sorted(items) or []
|
||||||
|
except SyntaxError as err:
|
||||||
|
functions[c] = ['SyntaxError:Line:%d' % err.lineno]
|
||||||
|
|
||||||
# Get all views
|
# Get all views
|
||||||
views = sorted(
|
views = sorted(
|
||||||
|
|||||||
Reference in New Issue
Block a user