Пример #1
0
def exception_xml_repr(exception, host = None, depth = 1, memo = None):
    exception_type, exception_value, traceback = exc_info()
    stack = extract_tb(traceback)[2:]
    return tags.div(
        {'class': 'python_traceback'},
        len(stack) and (
            tags.p(
                tags.b('Traceback'),
                ' (most recent call last)'
            ),
            tags.ul(
                {'class': 'python_traceback_stack'},
                (
                    tags.li(
                        {'class': 'python_traceback_stack_frame'},
                        'file ', tags.tt(
                            {'class': 'python_traceback_file_name'},
                            file_name
                        ),
                        ', line ', tags.tt(
                            {'class': 'python_traceback_line'},
                            line_number
                        ),
                        ', in ', tags.tt(
                            {'class': 'python_traceback_function_name'},
                            function_name
                        ),
                        text is not None and (
                            tags.br(),
                            tags.code(
                                {
                                    'class': 'python',
                                    'style': 'white-space: pre;',
                                },
                                xml_repr(text),
                            )
                        ) or ''
                    )
                    for 
                        file_name,
                        line_number,
                        function_name,
                        text
                    in
                        stack
                )
            )
        ) or '',
        tags.p(
            tags.b('%s.%s' % (
                exception_type.__module__,
                exception_type.__name__
            )),
            ' ',
            str(exception_value)
        ),
    )
Пример #2
0
def iterable_xml_repr(value, host = None, depth = 1, memo = None):
    # find tables
    return tags.p(
        tags.b(name_repr(value, memo)),
        tags.ol(
            {'start': 0},
            {'class': 'python_list'},
            (
                tags.li(
                    xml_repr(item, host, depth - 1, memo)
                )
                for item in value
            )
        )
    )
Пример #3
0
 def path_row(self, href, file_name):
     return tags.li(tags.a(href, href = href))