# Path: srs/mail.py
# def send_mail(
#     recipient_list,
#     subject,
#     mail_text,
#     headers=None,
#     cc=None,
#     bcc=None,
#     sender=settings.DEFAULT_FROM_EMAIL,
# ):
#     emailmsg = EmailMessage(
#         subject=subject,
#         body=mail_text,
#         from_email=sender,
#         to=recipient_list,
#         headers=headers,
#         cc=cc,
#         bcc=bcc,
#     )
# 
#     emailmsg.send()
# 
#     logger.info(
#         "sent email from '%s' about '%s' to '%s' and bcc '%s'",
#         sender,
#         subject,
#         recipient_list,
#         bcc,
#     )


import datetime
import logging
import operator
import os
import zlib
import ujson
from collections import Counter, OrderedDict, defaultdict
from functools import reduce
from os.path import basename
from background_task import background
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
from django.db import models
from django.db.models import Count
from django.db.models.deletion import CASCADE
from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver
from django.urls import reverse
from django.utils import timezone
from django_comments.models import Comment
from infolog_upload.notifications import Notifications
from .mail import send_mail
            pass

        # look for existing game name
        game = None
        for i in range(len(self.gametype)):
            _game = Game.objects.filter(name=self.gametype[: -1 * i])
            if _game.count() == 1:
                game = _game.first()
                break
            elif _game.count() > 1:
                msg = "Found %r Games with name %r: %r.\ngametype: %r\ngameID: %r\nmatch: %r." % (
                    _game.count(),
                    self.gametype[: -1 * i],
                    _game,
                    self.gametype,
                    self.gameID,
                    self.__unicode__(),
                )
                logger.error(msg)
                send_mail([x[1] for x in settings.ADMINS], "SRS: ambiguous game name", msg)
            else:
                pass
        if not game:
            logger.debug("not game")
            msg = "Unknown gametype: %r\ngameID: %r\nmatch: %r." % (
                self.gametype,
                self.gameID,
                self.__unicode__(),
            )
            logger.error(msg)

# Path: srs/mail.py
# def send_mail(
#     recipient_list,
#     subject,
#     mail_text,
#     headers=None,
#     cc=None,
#     bcc=None,
#     sender=settings.DEFAULT_FROM_EMAIL,
# ):
#     emailmsg = EmailMessage(
#         subject=subject,
#         body=mail_text,
#         from_email=sender,
#         to=recipient_list,
#         headers=headers,
#         cc=cc,
#         bcc=bcc,
#     )
# 
#     emailmsg.send()
# 
#     logger.info(
#         "sent email from '%s' about '%s' to '%s' and bcc '%s'",
#         sender,
#         subject,
#         recipient_list,
#         bcc,
#     )


# Path: srs/models.py
import datetime
import logging
import operator
import os
import zlib
import ujson
from collections import Counter, OrderedDict, defaultdict
from functools import reduce
from os.path import basename
from background_task import background
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
from django.db import models
from django.db.models import Count
from django.db.models.deletion import CASCADE
from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver
from django.urls import reverse
from django.utils import timezone
from django_comments.models import Comment
from infolog_upload.notifications import Notifications
from .mail import send_mail

            pass

        # look for existing game name
        game = None
        for i in range(len(self.gametype)):
            _game = Game.objects.filter(name=self.gametype[: -1 * i])
            if _game.count() == 1:
                game = _game.first()
                break
            elif _game.count() > 1:
                msg = "Found %r Games with name %r: %r.\ngametype: %r\ngameID: %r\nmatch: %r." % (
                    _game.count(),
                    self.gametype[: -1 * i],
                    _game,
                    self.gametype,
                    self.gameID,
                    self.__unicode__(),
                )
                logger.error(msg)
                send_mail([x[1] for x in settings.ADMINS], "SRS: ambiguous game name", msg)
            else:
                pass
        if not game:
            logger.debug("not game")
            msg = "Unknown gametype: %r\ngameID: %r\nmatch: %r." % (
                self.gametype,
                self.gameID,
                self.__unicode__(),
            )
            logger.error(msg)

            send_mail([x[1] for x in settings.ADMINS], "SRS: Unknown game name", msg)