[svn r37534] Some minor visual modifications for stack traces, fixed check for
py.code.Source object filenames. --HG-- branch : trunk
This commit is contained in:
parent
acfbbcb7ff
commit
853de83311
|
@ -636,15 +636,17 @@ class ApiPageBuilder(AbstractPageBuilder):
|
||||||
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_callsite(self, functionname, call_site):
|
||||||
tbtag = self.gen_traceback(functionname, call_site)
|
tbtag = self.gen_traceback(functionname, reversed(call_site))
|
||||||
tag = H.CallStackItem(
|
tag = H.CallStackItem(
|
||||||
H.a("%s - line %s" % (call_site[0].filename, call_site[0].lineno + 1),
|
H.a("show/hide stack trace %s - line %s" % (
|
||||||
|
call_site[0].filename, call_site[0].lineno + 1),
|
||||||
href='#',
|
href='#',
|
||||||
onclick="showhideel(getnextsibling(this)); return false;"),
|
onclick="showhideel(getnextsibling(this)); return false;"),
|
||||||
H.div(tbtag, style='display: none')
|
H.div(tbtag, style='display: none')
|
||||||
)
|
)
|
||||||
return tag
|
return tag
|
||||||
|
|
||||||
|
_reg_source = py.std.re.compile(r'([^>]*)<(.*)>')
|
||||||
def gen_traceback(self, funcname, call_site):
|
def gen_traceback(self, funcname, call_site):
|
||||||
tbdiv = H.div()
|
tbdiv = H.div()
|
||||||
for line in call_site:
|
for line in call_site:
|
||||||
|
@ -662,8 +664,8 @@ class ApiPageBuilder(AbstractPageBuilder):
|
||||||
linktext = '%s - line %s' % (sourcefile, line.lineno + 1)
|
linktext = '%s - line %s' % (sourcefile, line.lineno + 1)
|
||||||
# skip py.code.Source objects and source files outside of the
|
# skip py.code.Source objects and source files outside of the
|
||||||
# package
|
# package
|
||||||
if (not sourcefile.startswith('None') and
|
is_code_source = self._reg_source.match(sourcefile)
|
||||||
self.is_in_pkg(sourcefile)):
|
if (not is_code_source and self.is_in_pkg(sourcefile)):
|
||||||
href = self.linker.get_lazyhref(sourcefile)
|
href = self.linker.get_lazyhref(sourcefile)
|
||||||
sourcelink = H.a(linktext, href=href)
|
sourcelink = H.a(linktext, href=href)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue