0001-multitenant-include-tenant-domain-in-logging-emails-.patch
debian/debian_config_common.py | ||
---|---|---|
69 | 69 |
}, |
70 | 70 |
'mail_admins': { |
71 | 71 |
'level': 'ERROR', |
72 |
'class': 'django.utils.log.AdminEmailHandler',
|
|
72 |
'class': 'hobo.multitenant.log.AdminEmailHandler',
|
|
73 | 73 |
'include_html': True, |
74 | 74 |
}, |
75 | 75 |
'sentry': { |
hobo/multitenant/log.py | ||
---|---|---|
1 |
# hobo - portal to configure and deploy applications |
|
2 |
# Copyright (C) 2015-2018 Entr'ouvert |
|
3 |
# |
|
4 |
# This program is free software: you can redistribute it and/or modify it |
|
5 |
# under the terms of the GNU Affero General Public License as published |
|
6 |
# by the Free Software Foundation, either version 3 of the License, or |
|
7 |
# (at your option) any later version. |
|
8 |
# |
|
9 |
# This program is distributed in the hope that it will be useful, |
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
# GNU Affero General Public License for more details. |
|
13 |
# |
|
14 |
# You should have received a copy of the GNU Affero General Public License |
|
15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 | ||
17 |
from django.db import connection |
|
18 |
import django.utils.log |
|
19 | ||
20 | ||
21 |
class AdminEmailHandler(django.utils.log.AdminEmailHandler): |
|
22 |
def format_subject(self, subject): |
|
23 |
from .models import Tenant |
|
24 |
subject = super(AdminEmailHandler, self).format_subject(subject) |
|
25 |
tenant = connection.get_tenant() |
|
26 |
if isinstance(tenant, Tenant): |
|
27 |
subject = '[%s] %s' % (tenant.domain_url, subject) |
|
28 |
return subject |
|
0 |
- |