Projet

Général

Profil

0001-multitenant-include-tenant-domain-in-logging-emails-.patch

Frédéric Péters, 19 août 2018 16:21

Télécharger (2,28 ko)

Voir les différences:

Subject: [PATCH] multitenant: include tenant domain in logging emails (#25715)

 debian/debian_config_common.py |  2 +-
 hobo/multitenant/log.py        | 29 +++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 hobo/multitenant/log.py
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
        try:
26
            subject = '[%s] %s' % (connection.get_tenant().domain_url, subject)
27
        except AttributeError:
28
            pass
29
        return subject
0
-