Fix: ArchivePolicy enum truthiness evaluation (References mailman-core issue #1122)

Relates to Mailman-core Issue mailman#1122

HyperKitty duplicates ArchivePolicy from Mailman-core, where the issue discussed the evaluation of the boolean expression ArchivePolicy.never evaluates to True despite its value being 0 as the numeric values are not compared in the boolean expressions in Enum. This leads to confusion.

This MR mirrors the fix from Mailman Core by overriding __bool__ to raise a NotABooleanError, enforcing explicit checks like if policy is not ArchivePolicy.never: instead of relying on implicit truthiness.

Also added tests covering boolean evaluation for all three enum members.

Corresponding MR for Mailman Core has been raised. (mailman!1449)

Referenced Issue: mailman#1122

Merge request reports

Loading