/usr/lib/python2.7/dist-packages/hyperkitty/signals.py is in python-django-hyperkitty 1.1.4-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | # -*- coding: utf-8 -*-
# Copyright (C) 2015-2017 by the Free Software Foundation, Inc.
#
# This file is part of HyperKitty.
#
# HyperKitty is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# HyperKitty is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# HyperKitty. If not, see <http://www.gnu.org/licenses/>.
#
# Author: Aurelien Bompard <abompard@fedoraproject.org>
#
from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.db.models.signals import (
post_init, pre_save, post_save, pre_delete, post_delete)
from django.dispatch import receiver
from django_mailman3.signals import mailinglist_created, mailinglist_modified
from hyperkitty.lib.mailman import import_list_from_mailman
from hyperkitty.models.email import Email, Attachment
from hyperkitty.models.mailinglist import MailingList
from hyperkitty.models.profile import Profile
from hyperkitty.models.thread import Thread
from hyperkitty.models.vote import Vote
# Email
@receiver(post_init, sender=Email)
def Email_on_post_init(sender, **kwargs):
kwargs["instance"].on_post_init()
@receiver(pre_save, sender=Email)
def Email_on_pre_save(sender, **kwargs):
kwargs["instance"].on_pre_save()
@receiver(post_save, sender=Email)
def Email_on_post_save(sender, **kwargs):
if kwargs["created"]:
kwargs["instance"].on_post_created()
else:
kwargs["instance"].on_post_save()
@receiver(pre_delete, sender=Email)
def Email_on_pre_delete(sender, **kwargs):
kwargs["instance"].on_pre_delete()
@receiver(post_delete, sender=Email)
def Email_on_post_delete(sender, **kwargs):
kwargs["instance"].on_post_delete()
# Attachment
@receiver(pre_save, sender=Attachment)
def Attachment_on_pre_save(sender, **kwargs):
kwargs["instance"].on_pre_save()
# MailingList
@receiver(pre_save, sender=MailingList)
def MailingList_set_list_id(sender, **kwargs):
kwargs["instance"].on_pre_save()
# Profile
@receiver(post_save, sender=settings.AUTH_USER_MODEL)
def Profile_on_post_save(sender, **kwargs):
user = kwargs["instance"]
if not Profile.objects.filter(user=user).exists():
Profile.objects.create(user=user)
# Thread
@receiver(pre_save, sender=Thread)
def Thread_on_pre_save(sender, **kwargs):
kwargs["instance"].on_pre_save()
@receiver(post_save, sender=Thread)
def Thread_on_post_save(sender, **kwargs):
if kwargs["created"]:
kwargs["instance"].on_post_created()
else:
kwargs["instance"].on_post_save()
@receiver(post_delete, sender=Thread)
def Thread_on_post_delete(sender, **kwargs):
kwargs["instance"].on_post_delete()
# Vote
@receiver(post_save, sender=Vote)
def Vote_on_post_save(sender, **kwargs):
kwargs["instance"].on_post_save()
@receiver(post_delete, sender=Vote)
def Vote_on_post_delete(sender, **kwargs):
kwargs["instance"].on_post_delete()
# Mailman signals
@receiver(mailinglist_created)
def on_mailinglist_created(sender, **kwargs):
import_list_from_mailman(kwargs["list_id"])
@receiver(mailinglist_modified)
def on_mailinglist_modified(sender, **kwargs):
import_list_from_mailman(kwargs["list_id"])
|