[svn r38148] Made that stacks are built on seperate pages instead of inline in the function
information, to avoid having > 5MB pages... --HG-- branch : trunk
This commit is contained in:
parent
46f8c56c9b
commit
fff15f50f3
|
@ -160,15 +160,13 @@ class H(html):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class CallStackDescription(Description):
|
class CallStackDescription(Description):
|
||||||
def __init__(self, callstackdiv):
|
pass
|
||||||
super(H.CallStackDescription, self).__init__(
|
|
||||||
H.Hideable('callsites', 'callsites', csdiv))
|
|
||||||
|
|
||||||
class CallStackItem(html.div):
|
class CallStackLink(html.div):
|
||||||
def __init__(self, filename, lineno, traceback):
|
def __init__(self, filename, lineno, href):
|
||||||
super(H.CallStackItem, self).__init__(
|
super(H.CallStackLink, self).__init__(
|
||||||
H.Hideable("stack trace %s - line %s" % (filename, lineno),
|
H.a("stack trace %s - line %s" % (filename, lineno),
|
||||||
'callstackitem', traceback))
|
href=href))
|
||||||
|
|
||||||
class Hideable(html.div):
|
class Hideable(html.div):
|
||||||
def __init__(self, name, class_, *content):
|
def __init__(self, name, class_, *content):
|
||||||
|
|
|
@ -341,13 +341,9 @@ class ApiPageBuilder(AbstractPageBuilder):
|
||||||
href = self.linker.get_lazyhref(sourcefile)
|
href = self.linker.get_lazyhref(sourcefile)
|
||||||
|
|
||||||
csource = H.SourceSnippet(text, href, colored)
|
csource = H.SourceSnippet(text, href, colored)
|
||||||
callstack = self.dsa.get_function_callpoints(dotted_name)
|
cslinks = self.build_callsites(dotted_name)
|
||||||
csitems = []
|
|
||||||
for cs, _ in callstack:
|
|
||||||
csitems.append(self.build_callsite(dotted_name, cs))
|
|
||||||
snippet = H.FunctionDescription(localname, argdesc, docstring,
|
snippet = H.FunctionDescription(localname, argdesc, docstring,
|
||||||
valuedesc, csource, csitems)
|
valuedesc, csource, cslinks)
|
||||||
|
|
||||||
return snippet
|
return snippet
|
||||||
|
|
||||||
def build_class_view(self, dotted_name):
|
def build_class_view(self, dotted_name):
|
||||||
|
@ -589,14 +585,30 @@ class ApiPageBuilder(AbstractPageBuilder):
|
||||||
def is_in_pkg(self, sourcefile):
|
def is_in_pkg(self, sourcefile):
|
||||||
return py.path.local(sourcefile).relto(self.projpath)
|
return py.path.local(sourcefile).relto(self.projpath)
|
||||||
|
|
||||||
def build_callsite(self, functionname, call_site):
|
def build_callsites(self, dotted_name):
|
||||||
tbtag = self.gen_traceback(functionname, reversed(call_site))
|
callstack = self.dsa.get_function_callpoints(dotted_name)
|
||||||
return H.CallStackItem(call_site[0].filename, call_site[0].lineno + 1,
|
cslinks = []
|
||||||
tbtag)
|
for i, (cs, _) in enumerate(callstack):
|
||||||
|
link = self.build_callsite(dotted_name, cs, i)
|
||||||
|
cslinks.append(link)
|
||||||
|
return cslinks
|
||||||
|
|
||||||
|
def build_callsite(self, dotted_name, call_site, index):
|
||||||
|
tbtag = self.gen_traceback(dotted_name, reversed(call_site))
|
||||||
|
parent_dotted_name, _ = split_of_last_part(dotted_name)
|
||||||
|
nav = self.build_navigation(parent_dotted_name, False)
|
||||||
|
id = 'callsite_%s_%s' % (dotted_name, index)
|
||||||
|
reltargetpath = "api/%s.html" % (id,)
|
||||||
|
self.linker.set_link(id, reltargetpath)
|
||||||
|
href = self.linker.get_lazyhref(id)
|
||||||
|
self.write_page('call site %s for %s' % (index, dotted_name),
|
||||||
|
reltargetpath, tbtag, nav)
|
||||||
|
return H.CallStackLink(call_site[0].filename, call_site[0].lineno + 1,
|
||||||
|
href)
|
||||||
|
|
||||||
_reg_source = py.std.re.compile(r'([^>]*)<(.*)>')
|
_reg_source = py.std.re.compile(r'([^>]*)<(.*)>')
|
||||||
def gen_traceback(self, funcname, call_site):
|
def gen_traceback(self, dotted_name, call_site):
|
||||||
tbdiv = H.div()
|
tbtag = H.CallStackDescription()
|
||||||
for frame in call_site:
|
for frame in call_site:
|
||||||
lineno = frame.lineno - frame.firstlineno
|
lineno = frame.lineno - frame.firstlineno
|
||||||
source = frame.source
|
source = frame.source
|
||||||
|
@ -631,7 +643,7 @@ class ApiPageBuilder(AbstractPageBuilder):
|
||||||
else:
|
else:
|
||||||
sourcelink = H.div('source unknown (%s)' % (sourcefile,))
|
sourcelink = H.div('source unknown (%s)' % (sourcefile,))
|
||||||
colored = mangled[:]
|
colored = mangled[:]
|
||||||
tbdiv.append(sourcelink)
|
tbtag.append(sourcelink)
|
||||||
tbdiv.append(H.div(*colored))
|
tbtag.append(H.div(*colored))
|
||||||
return tbdiv
|
return tbtag
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,11 @@ def setup_fs_project(name):
|
||||||
exec c in globals()
|
exec c in globals()
|
||||||
|
|
||||||
assert pak.somenamespace._hidden() == 'quux'
|
assert pak.somenamespace._hidden() == 'quux'
|
||||||
|
|
||||||
|
# this just to see a multi-level stack in the docs
|
||||||
|
def foo():
|
||||||
|
return pak.main.sub.func(10)
|
||||||
|
assert foo() is None
|
||||||
"""))
|
"""))
|
||||||
return temp, 'pak'
|
return temp, 'pak'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue