mirror of
https://github.com/modoboa/modoboa.git
synced 2026-04-26 01:16:01 +03:00
[GH-ISSUE #2503] Admin->Domains->SomeDomain Internal server error #1612
Labels
No labels
bug
bug
dependencies
design
documentation
duplicate
enhancement
enhancement
enhancement
feedback-needed
help-needed
help-needed
installer
invalid
looking-for-sponsors
modoboa-contacts
new-ui
new-ui
pr
pull-request
pyconfr
python
question
security
stale
webmail
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/modoboa-modoboa#1612
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @angelshtilianov on GitHub (Apr 29, 2022).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/2503
Impacted versions
Steps to reproduce
Create/edit a domain, and set "Message sending limit" to zero, save/update/
Then go to Admin->Domains->The_Domain_From_Above
Current behavior
Internal server error is generated and the domain is not manageable from web interface.
The problem was tracked down to division by zero in
/srv/modoboa/env/lib/python3.8/site-packages/modoboa/admin/models/mixins.py
And I have fixed it by adding zero check.
def sent_messages_in_percent(self):
"""Return number of sent messages as a percentage."""
if self.message_limit is None:
return None
Please someone more familiar with Modoboa to take a look into this fix. I had several cases in the past where I had to delete the domain I've just created, but I didn't debug it back then. I suppose I've been doing the same.
Expected behavior
Should not crash, even there are some glitches.