changeset 7588:8329b2227adb

fix: restore roundup-admin display output format w/o pragmas Do not indent the display output unless user requested protected fields or headers. This returns the format to what it was prior to 2.3.0. Parsing roundup-admin output programmaticly was never a use case, but don't break the output format without a reason.
author John Rouillard <rouilj@ieee.org>
date Wed, 26 Jul 2023 11:05:10 -0400
parents 8f29e4ea05ce
children 6894f152d49a
files CHANGES.txt roundup/admin.py
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Tue Jul 25 16:30:10 2023 -0400
+++ b/CHANGES.txt	Wed Jul 26 11:05:10 2023 -0400
@@ -37,6 +37,11 @@
 - issue2551278 - datetime.datetime.utcnow deprecation. Replace
   calls with equivalent that produces timezone aware dates rather than
   naive dates. (John Rouillard)
+- when using "roundup-admin display" indent the listing only if
+  headers or protected fields are requested. This makes the output
+  look like it did previously to 2.3.0 if the new features aren't
+  used.  Roundup-admin output was never meant to be machine parsed, but
+  don't break it unless required. (John Rouillard)
 
 Features:
 
--- a/roundup/admin.py	Tue Jul 25 16:30:10 2023 -0400
+++ b/roundup/admin.py	Wed Jul 26 11:05:10 2023 -0400
@@ -521,6 +521,9 @@
         if len(args) < 1:
             raise UsageError(_('Not enough arguments supplied'))
 
+        display_protected = self.settings['display_protected']
+        display_header =  self.settings['display_header']
+
         # decode the node designator
         for designator in args[0].split(','):
             try:
@@ -533,19 +536,22 @@
 
             # display the values
             normal_props = sorted(cl.properties)
-            if self.settings['display_protected']:
+            if display_protected:
                 keys = sorted(cl.getprops())
             else:
                 keys = normal_props
 
-            if self.settings['display_header']:
+            if display_header:
                 status = "retired" if cl.is_retired(nodeid) else "active"
                 print('\n[%s (%s)]' % (designator, status))
             for key in keys:
                 value = cl.get(nodeid, key)
                 # prepend * for protected properties else just indent
                 # with space.
-                protected = "*" if key not in normal_props else ' '
+                if display_protected or display_header:
+                    protected = "*" if key not in normal_props else ' '
+                else:
+                    protected = ""
                 print(_('%(protected)s%(key)s: %(value)s') % locals())
 
     def do_export(self, args, export_files=True):

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