Debian Codegraph @

cas_server/management/commands/cas_clean_sessions.py

raw
1 # -*- coding: utf-8 -*-
2 # This program is distributed in the hope that it will be useful, but WITHOUT
3 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
4 # FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for
5 # more details.
6 #
7 # You should have received a copy of the GNU General Public License version 3
8 # along with this program; if not, write to the Free Software Foundation, Inc., 51
9 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
10 #
11 # (c) 2016-2020 Valentin Samir
12 """Clean deleted sessions management command"""
13 from django.core.management.base import BaseCommand
14
15 from ... import models
16
17 import sys
18 if sys.version_info < (3,):
19 from django.utils.translation import ugettext_lazy as _
20 else:
21 from django.utils.translation import gettext_lazy as _
22
23
24 class Command(BaseCommand):
25 """Clean deleted sessions"""
26 args = ''
27 help = _(u"Clean deleted sessions")
28
29 def handle(self, *args, **options):
30 models.User.clean_deleted_sessions()
31 models.UserAttributes.clean_old_entries()
32 models.NewVersionWarning.send_mails()