Switch to unified view

a/Allura/allura/lib/utils.py b/Allura/allura/lib/utils.py
...
...
18
from pylons import response
18
from pylons import response
19
from pylons import tmpl_context as c
19
from pylons import tmpl_context as c
20
from paste.httpheaders import CACHE_CONTROL, EXPIRES
20
from paste.httpheaders import CACHE_CONTROL, EXPIRES
21
from webhelpers.html import literal
21
from webhelpers.html import literal
22
from webob import exc
22
from webob import exc
23
from pygments.formatters import HtmlFormatter
23
24
24
from ew import jinja2_ew as ew
25
from ew import jinja2_ew as ew
25
from ming.utils import LazyProperty
26
from ming.utils import LazyProperty
26
27
27
def permanent_redirect(url):
28
def permanent_redirect(url):
...
...
391
        # p.interaction(None, tb)
392
        # p.interaction(None, tb)
392
    except ImportError:
393
    except ImportError:
393
        sys.stderr.write('Entering post-mortem PDB shell\n')
394
        sys.stderr.write('Entering post-mortem PDB shell\n')
394
        traceback.print_exception(etype, value, tb)
395
        traceback.print_exception(etype, value, tb)
395
        pdb.post_mortem(tb)
396
        pdb.post_mortem(tb)
397
398
class LineAnchorCodeHtmlFormatter(HtmlFormatter):
399
    def _wrap_pre(self, inner):
400
        style = []
401
        if self.prestyles:
402
            style.append(self.prestyles)
403
        if self.noclasses:
404
            style.append('line-height: 125%')
405
        style = '; '.join(style)
406
407
        num = self.linenostart
408
        yield 0, ('<pre' + (style and ' style="%s"' % style) + '>')
409
        for tup in inner:
410
            yield (tup[0], '<a class="linelink" href="#codeline_%s">'\
411
                           '<div id="codeline_%s" class="code_block">%s</div></a>' % (num, num, tup[1]))
412
            num += 1
413
        yield 0, '</pre>'