include filename
This commit is contained in:
parent
94613dc674
commit
1014bc8a89
2 changed files with 5 additions and 3 deletions
|
@ -99,7 +99,8 @@ class ApiActions(dict):
|
||||||
f = self[name]
|
f = self[name]
|
||||||
if name != 'api' and hasattr(f, 'func_closure') and f.func_closure:
|
if name != 'api' and hasattr(f, 'func_closure') and f.func_closure:
|
||||||
f = f.func_closure[0].cell_contents
|
f = f.func_closure[0].cell_contents
|
||||||
return trim(inspect.getsource(f))
|
filename = f.func_code.co_filename[len(settings.PROJECT_ROOT)+1:]
|
||||||
|
return filename, trim(inspect.getsource(f))
|
||||||
|
|
||||||
def register(self, method, action=None, cache=True):
|
def register(self, method, action=None, cache=True):
|
||||||
if not action:
|
if not action:
|
||||||
|
|
|
@ -123,7 +123,7 @@ function constructList() {
|
||||||
.html(app.actions[k].doc.replace('/\n/<br>\n/g'))
|
.html(app.actions[k].doc.replace('/\n/<br>\n/g'))
|
||||||
.appendTo(info);
|
.appendTo(info);
|
||||||
var $code = $('<code class=" python">')
|
var $code = $('<code class=" python">')
|
||||||
.html(app.actions[k].code.replace('/\n/<br>\n/g'))
|
.html(app.actions[k].code[1].replace('/\n/<br>\n/g'))
|
||||||
.hide();
|
.hide();
|
||||||
var $button = new Ox.Button({
|
var $button = new Ox.Button({
|
||||||
title: [
|
title: [
|
||||||
|
@ -135,7 +135,8 @@ function constructList() {
|
||||||
.addClass("margin")
|
.addClass("margin")
|
||||||
.click(function() { $code.toggle()})
|
.click(function() { $code.toggle()})
|
||||||
.appendTo(info)
|
.appendTo(info)
|
||||||
$('<span>').html(' View Python Source').appendTo(info)
|
var f = app.actions[k].code[0];
|
||||||
|
$('<span>').html(' View Source ('+f+')').appendTo(info)
|
||||||
$('<pre>').append($code).appendTo(info)
|
$('<pre>').append($code).appendTo(info)
|
||||||
hljs.highlightBlock($code[0], ' ');
|
hljs.highlightBlock($code[0], ' ');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue