From 1014bc8a89f72ab8a67f6dd29b26c66d548a36e8 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 26 Jan 2011 19:46:40 +0530 Subject: [PATCH] include filename --- pandora/api/actions.py | 3 ++- static/js/pandora.api.js | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pandora/api/actions.py b/pandora/api/actions.py index 7c468992..08347d0a 100644 --- a/pandora/api/actions.py +++ b/pandora/api/actions.py @@ -99,7 +99,8 @@ class ApiActions(dict): f = self[name] if name != 'api' and hasattr(f, 'func_closure') and f.func_closure: 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): if not action: diff --git a/static/js/pandora.api.js b/static/js/pandora.api.js index 84060531..c7f36dff 100755 --- a/static/js/pandora.api.js +++ b/static/js/pandora.api.js @@ -123,7 +123,7 @@ function constructList() { .html(app.actions[k].doc.replace('/\n/
\n/g')) .appendTo(info); var $code = $('') - .html(app.actions[k].code.replace('/\n/
\n/g')) + .html(app.actions[k].code[1].replace('/\n/
\n/g')) .hide(); var $button = new Ox.Button({ title: [ @@ -135,7 +135,8 @@ function constructList() { .addClass("margin") .click(function() { $code.toggle()}) .appendTo(info) - $('').html(' View Python Source').appendTo(info) + var f = app.actions[k].code[0]; + $('').html(' View Source ('+f+')').appendTo(info) $('
').append($code).appendTo(info) 
                 hljs.highlightBlock($code[0], '    ');