Switch to unified view

a/Allura/allura/lib/macro.py b/Allura/allura/lib/macro.py
1
import cgi
1
import cgi
2
import shlex
2
import shlex
3
import logging
3
import logging
4
4
5
import ew
6
import pymongo
5
import pymongo
7
from pylons import c, g, request
6
from pylons import c, g, request
8
7
9
from . import helpers as h
8
from . import helpers as h
10
9
...
...
63
@macro
62
@macro
64
def include(ref=None, **kw):
63
def include(ref=None, **kw):
65
    from allura import model as M
64
    from allura import model as M
66
    from allura.lib.widgets.macros import Include
65
    from allura.lib.widgets.macros import Include
67
    if ref is None: return '[-include-]'
66
    if ref is None: return '[-include-]'
68
    link = M.ArtifactLink.lookup('[' + ref + ']')
67
    link = M.Shortlink.lookup(ref)
69
    if not link: return '[[include %s]]' % ref
68
    if not link: return '[[include %s]]' % ref
70
    aref = M.ArtifactReference(link.artifact_reference)
71
    artifact = aref.artifact
69
    artifact = link.ref.artifact
72
    if artifact is None: return '[[include %s]]' % ref
70
    if artifact is None: return '[[include %s]]' % ref
73
    included = request.environ.setdefault('allura.macro.included', set())
71
    included = request.environ.setdefault('allura.macro.included', set())
74
    if artifact in included:
72
    if artifact in included:
75
        return '[-...-]'
73
        return '[-...-]'
76
    else:
74
    else: