Skip to content

Added flexible output formatting and CSV export to showaccounting#556

Merged
Martin-Rehr merged 15 commits into
nextfrom
adjust/showaccounting
May 18, 2026
Merged

Added flexible output formatting and CSV export to showaccounting#556
Martin-Rehr merged 15 commits into
nextfrom
adjust/showaccounting

Conversation

@Martin-Rehr
Copy link
Copy Markdown
Contributor

@Martin-Rehr Martin-Rehr commented May 13, 2026

Add flexible output formatting and CSV export to showaccounting
This PR extends showaccounting with several output formatting options and a CSV export mode, making it more useful for both operational and management reporting.
New features:

  • Show User details from database instead of userid string
  • Decimal precision (-d): Control the number of decimal places shown in file size output, defaulting to 3.
  • Locale formatting (-l): Format numbers according to a specific locale, allowing region-appropriate number formatting such as comma vs. period as decimal separator.
  • SI byte units (-i): Show file sizes in SI units (KB, MB, GB, TB — powers of 10) alongside the standard binary units (KiB, MiB, GiB, TiB), making it easier to compare with storage vendor figures.
  • CSV summary (-s): Export a semicolon-delimited summary of user storage usage, including both raw bytes and formatted TiB or TB values, suitable for import into spreadsheets or reporting tools.

* Specifying number of formatting decimals
* Formatting numbers due to local settings
* SI byte units
* CSV output format
@Martin-Rehr Martin-Rehr requested a review from a team May 13, 2026 14:27
@Martin-Rehr Martin-Rehr self-assigned this May 13, 2026
@Martin-Rehr Martin-Rehr added the enhancement New feature or request label May 13, 2026
Add tests for the decimals, si_byte_format, and locale_format parameters
added to human_readable_filesize and get_usage, verify the updated
ext_users_report format (parsed name/email/org/country via
distinguished_name_to_user), and close several behavioural gaps:

- get_usage returns None when no accounting file exists
- ext users appear in a full dump but are suppressed when a targeted
  userlist is given that does not include them, and re-exposed when they
  are listed explicitly
- freeze quota files are ignored when site_enable_freeze is False
- human_readable_filesize(1) boundary case
Comment thread bin/showaccounting.py Outdated
Comment thread bin/showaccounting.py Outdated
Comment thread bin/showaccounting.py Outdated
Comment thread bin/showaccounting.py
Comment thread bin/showaccounting.py Outdated
Comment thread bin/showaccounting.py Outdated
Comment thread bin/showaccounting.py Outdated
Comment thread bin/showaccounting.py Outdated
Comment thread bin/showaccounting.py Outdated
Comment thread bin/showaccounting.py Outdated
Comment thread mig/lib/accounting.py
Comment thread mig/lib/accounting.py Outdated
Comment thread mig/lib/accounting.py Outdated
Comment thread mig/lib/accounting.py
Comment thread mig/lib/accounting.py Outdated
Comment thread tests/test_mig_lib_accounting.py Outdated
Copy link
Copy Markdown
Contributor

@jonasbardino jonasbardino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. No obvious show-stoppers but a few things to address or consider. Please just comment and re-request review from me if/when you need the approval.

@Martin-Rehr
Copy link
Copy Markdown
Contributor Author

Thanks for the review @jonasbardino I've addressed all comments

@Martin-Rehr Martin-Rehr requested a review from jonasbardino May 15, 2026 12:31
Copy link
Copy Markdown
Contributor

@jonasbardino jonasbardino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Approved.

@Martin-Rehr Martin-Rehr merged commit e8dd6d6 into next May 18, 2026
11 checks passed
@Martin-Rehr Martin-Rehr deleted the adjust/showaccounting branch May 18, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants