|
a/Allura/allura/lib/macro.py |
|
b/Allura/allura/lib/macro.py |
|
... |
|
... |
33 |
return response
|
33 |
return response
|
34 |
except (ValueError, TypeError), ex:
|
34 |
except (ValueError, TypeError), ex:
|
35 |
msg = cgi.escape(u'[[%s]] (%s)' % (s, repr(ex)))
|
35 |
msg = cgi.escape(u'[[%s]] (%s)' % (s, repr(ex)))
|
36 |
return '\n<div class="error"><pre><code>%s</code></pre></div>' % msg
|
36 |
return '\n<div class="error"><pre><code>%s</code></pre></div>' % msg
|
37 |
except Exception, ex:
|
37 |
except Exception, ex:
|
|
|
38 |
raise
|
38 |
return '[[Error parsing %s: %s]]' % (s, ex)
|
39 |
return '[[Error parsing %s: %s]]' % (s, ex)
|
39 |
|
40 |
|
40 |
@macro
|
41 |
@macro
|
41 |
def projects(category=None, display_mode='grid', sort='last_updated'):
|
42 |
def projects(category=None, display_mode='grid', sort='last_updated'):
|
42 |
from allura.lib.widgets.project_list import ProjectList
|
43 |
from allura.lib.widgets.project_list import ProjectList
|
|
... |
|
... |
65 |
from allura.lib.widgets.macros import Include
|
66 |
from allura.lib.widgets.macros import Include
|
66 |
if ref is None: return '[-include-]'
|
67 |
if ref is None: return '[-include-]'
|
67 |
link = M.ArtifactLink.lookup('[' + ref + ']')
|
68 |
link = M.ArtifactLink.lookup('[' + ref + ']')
|
68 |
if not link: return '[[include %s]]' % ref
|
69 |
if not link: return '[[include %s]]' % ref
|
69 |
aref = M.ArtifactReference(link.artifact_reference)
|
70 |
aref = M.ArtifactReference(link.artifact_reference)
|
70 |
artifact = aref.to_artifact()
|
71 |
artifact = aref.artifact
|
|
|
72 |
if artifact is None: return '[[include %s]]' % ref
|
71 |
included = request.environ.setdefault('allura.macro.included', set())
|
73 |
included = request.environ.setdefault('allura.macro.included', set())
|
72 |
if artifact in included:
|
74 |
if artifact in included:
|
73 |
return '[-...-]'
|
75 |
return '[-...-]'
|
74 |
else:
|
76 |
else:
|
75 |
included.add(artifact)
|
77 |
included.add(artifact)
|