You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2026/01/20 14:58:56 UTC

(allura) 01/02: User.__repr__ fix in case display_name is not available

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 8fd1f9607ca7d3d7a01672f9079ed0b3703a22b7
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Tue Jan 20 09:57:10 2026 -0500

    User.__repr__ fix in case display_name is not available
---
 Allura/allura/model/auth.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 81f1166e4..d4aa4e677 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -333,8 +333,12 @@ class __mongometa__:
         session_ua=str))
 
     def __repr__(self):
-        return ('<User username={s.username!r} display_name={s.display_name!r} _id={s._id!r} '
-                'disabled={s.disabled!r} pending={s.pending!r}>'.format(s=self))
+        try:
+            display_name = self.display_name
+        except AttributeError:
+            display_name = None
+        return ('<User username={s.username!r} display_name={display_name!r} _id={s._id!r} '
+                'disabled={s.disabled!r} pending={s.pending!r}>'.format(s=self, display_name=display_name))
 
     def index(self):
         provider = plugin.AuthenticationProvider.get(None)  # no need in request here