Bump copyright year
[mailman-postorious.git] / src / postorius / views / system.py
blob86390f30f03587895e4b7fe15827b0be92944d25
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2018-2022 by the Free Software Foundation, Inc.
4 # This file is part of Postorius.
6 # Postorius is free software: you can redistribute it and/or modify it under
7 # the terms of the GNU General Public License as published by the Free
8 # Software Foundation, either version 3 of the License, or (at your option)
9 # any later version.
11 # Postorius is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 # more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Postorius. If not, see <http://www.gnu.org/licenses/>.
20 from django.contrib.auth.decorators import login_required
21 from django.shortcuts import render
23 from django_mailman3.lib.mailman import get_mailman_client
25 from postorius.auth.decorators import superuser_required
26 from postorius.views.generic import bans_view
29 SYSTEM_INFO_KEYS = (
30 ('mailman_version', 'Mailman Core Version'),
31 ('api_version', 'Mailman Core API Version'),
32 ('python_version', 'Mailman Core Python Version'),
36 @login_required
37 @superuser_required
38 def system_information(request):
39 client = get_mailman_client()
40 all_configs = client.system
42 configs = []
43 for key, name in SYSTEM_INFO_KEYS:
44 configs.append((name, all_configs.get(key)))
46 return render(
47 request,
48 'postorius/system_information.html',
49 {'configs': configs},
53 @login_required
54 @superuser_required
55 def bans(request):
56 return bans_view(request, template='postorius/bans.html')