misc: do not send error emails when in maintenance mode (#71527) #54

Merged
fpeters merged 1 commits from wip/71527-maintenance-no-emails into main 2023-08-02 11:54:10 +02:00
1 changed files with 7 additions and 0 deletions

View File

@ -15,10 +15,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import django.utils.log
from django.conf import settings
from django.db import connection
class AdminEmailHandler(django.utils.log.AdminEmailHandler):
def emit(self, record):
maintenance_mode = getattr(settings, 'MAINTENANCE_PAGE', None)
if maintenance_mode:
return
return super().emit(record)
def format_subject(self, subject):
from .models import Tenant