This is an automated email from the ASF dual-hosted git repository. brondsem pushed a commit to branch db/8592 in repository https://gitbox.apache.org/repos/asf/allura.git
commit 3e3032437a09a657be91fb6f1a3607906bbbd531 Author: Dave Brondsema <[email protected]> AuthorDate: Mon Dec 8 11:47:26 2025 -0500 [#8592] show less error details on failed macros for anonymous users (incl scripts like reindex) --- Allura/allura/lib/macro.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Allura/allura/lib/macro.py b/Allura/allura/lib/macro.py index 61dbea85a..c3ebca198 100644 --- a/Allura/allura/lib/macro.py +++ b/Allura/allura/lib/macro.py @@ -104,8 +104,19 @@ def __call__(self, s): log.warning('macro error. Upwards stack is %s', ''.join(traceback.format_stack()), exc_info=True) - msg = html.escape(f'[[{s}]] ({repr(ex)})') - return '\n<div class="error"><pre><code>%s</code></pre></div>' % msg + try: + current_user = g.user + except AttributeError: + anon_user = True # test or background script + else: + anon_user = current_user.is_anonymous() + if anon_user: + # show a bit less detail + msg = html.escape(f'[[{s}]] (error processing macro)') + return f'\n<pre><code>{msg}</code></pre>' + else: + msg = html.escape(f'[[{s}]] ({ex})') + return f'\n<div class="error"><pre><code>{msg}</code></pre></div>' def _lookup_macro(self, s): macro = _macros.get(s)
