This file is indexed.

/usr/lib/python2.7/dist-packages/sagenb/notebook/notification.py is in python-sagenb 1.0.1+ds1-2.

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
# -*- coding: utf-8 -*
import logging
from .sage_email import default_email_address
from .smtpsend import send_mail
from socket import getfqdn

logger = logging.getLogger('notification')


class TwistedEmailHandler(logging.Handler):
    """Sends log messages via SMTP using a running twisted reactor."""
    def __init__(self, conf, level=logging.NOTSET):
        logging.Handler.__init__(self, level)
        self.conf = conf
        self.setFormatter(
            logging.Formatter('''
Host:               %(fqdn)s
Message type:       %(levelname)s
Location:           %(pathname)s:%(lineno)d
Module:             %(module)s
Function:           %(funcName)s
Time:               %(asctime)s

Message:

%(message)s

'''))

    def emit(self, record):
        fqdn = getfqdn()
        from_address = default_email_address()
        subject = '[sage-notebook] %s' % fqdn
        record.fqdn = fqdn
        message = self.format(record)

        recipients = self.conf['notification_recipients']
        if recipients is None:
            recipients = []
        for rcpt in recipients:
            to = rcpt.strip()
            send_mail(from_address, to, subject, message)