changeset 8490:918792e35e0c

issue2551413 - Broken MultiLink columns in CSV export cmeerw found a crash and bug. While investigating CSV export using names with a multilink field that doesn't have a label field (name or realname for user class). cmeerw's patch displays a multilink like messages as "['12', '23']" as when exporting csv with id. I changes code so this displays as "12;23" to match the list format output of the other fields in export csv (with names).
author John Rouillard <rouilj@ieee.org>
date Sat, 13 Dec 2025 23:02:53 -0500
parents 4e0944649af7
children 520075b29474
files CHANGES.txt roundup/cgi/actions.py
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Mon Dec 08 23:07:57 2025 -0500
+++ b/CHANGES.txt	Sat Dec 13 23:02:53 2025 -0500
@@ -37,6 +37,10 @@
   script. Found/patch by Norbert Schlemmer. (John Rouillard)
 - change some internal classes to use __slots__ for hopefully a small
   performance improvement. (John Rouillard)
+- issue2551413 - Broken MultiLink columns in CSV export. CSV export of
+  a multilink link "messages" that does not have a 'name' property
+  causes a crash. (found/fix by cmeerw; commit and better handling of
+  non-labeled multilink by John Rouillard)
   
 Features:
 
--- a/roundup/cgi/actions.py	Mon Dec 08 23:07:57 2025 -0500
+++ b/roundup/cgi/actions.py	Sat Dec 13 23:02:53 2025 -0500
@@ -1688,7 +1688,6 @@
             if isinstance(props[col], hyperdb.Multilink):
                 cname = props[col].classname
                 cclass = self.db.getclass(cname)
-                represent[col] = repr_list(cclass, 'name')
                 if not self.hasPermission(self.permissionType, classname=cname):
                     represent[col] = repr_no_right(cclass, 'name')
                 else:
@@ -1696,6 +1695,10 @@
                         represent[col] = repr_list(cclass, 'name')
                     elif cname == 'user':
                         represent[col] = repr_list(cclass, 'realname')
+                    else:
+                        # handle cases like messages which have no
+                        # useful label field issue2551413 
+                        represent[col] = repr_list(cclass, 'id')
             if isinstance(props[col], hyperdb.Link):
                 cname = props[col].classname
                 cclass = self.db.getclass(cname)

Roundup Issue Tracker: http://roundup-tracker.org/