Skip to content

Commit aa19d60

Browse files
committed
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.
1 parent 272bc7b commit aa19d60

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

CHANGES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ Fixed:
3737
- issue2551278 - datetime.datetime.utcnow deprecation. Replace
3838
calls with equivalent that produces timezone aware dates rather than
3939
naive dates. (John Rouillard)
40+
- when using "roundup-admin display" indent the listing only if
41+
headers or protected fields are requested. This makes the output
42+
look like it did previously to 2.3.0 if the new features aren't
43+
used. Roundup-admin output was never meant to be machine parsed, but
44+
don't break it unless required. (John Rouillard)
4045

4146
Features:
4247

roundup/admin.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,9 @@ def do_display(self, args):
521521
if len(args) < 1:
522522
raise UsageError(_('Not enough arguments supplied'))
523523

524+
display_protected = self.settings['display_protected']
525+
display_header = self.settings['display_header']
526+
524527
# decode the node designator
525528
for designator in args[0].split(','):
526529
try:
@@ -533,19 +536,22 @@ def do_display(self, args):
533536

534537
# display the values
535538
normal_props = sorted(cl.properties)
536-
if self.settings['display_protected']:
539+
if display_protected:
537540
keys = sorted(cl.getprops())
538541
else:
539542
keys = normal_props
540543

541-
if self.settings['display_header']:
544+
if display_header:
542545
status = "retired" if cl.is_retired(nodeid) else "active"
543546
print('\n[%s (%s)]' % (designator, status))
544547
for key in keys:
545548
value = cl.get(nodeid, key)
546549
# prepend * for protected properties else just indent
547550
# with space.
548-
protected = "*" if key not in normal_props else ' '
551+
if display_protected or display_header:
552+
protected = "*" if key not in normal_props else ' '
553+
else:
554+
protected = ""
549555
print(_('%(protected)s%(key)s: %(value)s') % locals())
550556

551557
def do_export(self, args, export_files=True):

0 commit comments

Comments
 (0)