<commit_before>from django.contrib.auth.models import User
from django.db.models.signals import pre_save, post_save
from django.conf import settings

from IssueTracker import utils
from IssueTracker import newIssueSignal, changedIssueSignal, forms, Email
from IssueTracker.models import Issue, IssueComment, ResolveState, ProblemType

def sendCreateIssueEmail(sender, instance=None, created=False, **kwargs):
    """
    Send an email for issue creation to the reporter, group contact, and CC
    """
    # retrieve the group from Instance
    if instance.group == None and instance.item == None or not created:
        return
    contacts = [c.email for c in utils.getIssueContacts(instance)]

    # send an email to this contact
    em = Email.NewIssueEmail(instance, instance.title)
    
    # if (instance.assignee is None)        
    try:
        em.addTo(instance.reporter.email)
    except:
        pass
    p_types = []
    for p_type in instance.problem_type.all():
        p_types.append(p_type.pk)
    em.addProblemTypeSection("", p_types) 
    if (instance.assignee is None):
        if instance.group:
            group_name = group.name
        else:
            group_name = 'None'

        em.addCommentSection(None, "Submitted by " + instance.reporter.username + ".\n"
        + "Group/Location: " + group_name + ".\n"     
	    + "Machine Name: " + instance.item.name + ".\n"
	    + "Description: " + "\n" + instance.description + "\n\n"
        + "Steps: " + "\n" + instance.steps + "\n\n"
        + "Attempts: " + "\n" + instance.attempts + "\n\n")
    else:
        em.addCommentSection(None, "Submitted by " + instance.reporter.username + ".\n"<commit_msg>Further fixed signals.py.<commit_after>from django.contrib.auth.models import User
from django.db.models.signals import pre_save, post_save
from django.conf import settings

from IssueTracker import utils
from IssueTracker import newIssueSignal, changedIssueSignal, forms, Email
from IssueTracker.models import Issue, IssueComment, ResolveState, ProblemType

def sendCreateIssueEmail(sender, instance=None, created=False, **kwargs):
    """
    Send an email for issue creation to the reporter, group contact, and CC
    """
    # retrieve the group from Instance
    if instance.group == None and instance.item == None or not created:
        return
    contacts = [c.email for c in utils.getIssueContacts(instance)]

    # send an email to this contact
    em = Email.NewIssueEmail(instance, instance.title)
    
    # if (instance.assignee is None)        
    try:
        em.addTo(instance.reporter.email)
    except:
        pass
    p_types = []
    for p_type in instance.problem_type.all():
        p_types.append(p_type.pk)
    em.addProblemTypeSection("", p_types) 
    if instance.group:
        group_name = instance.group.name
    else:
        group_name = 'None'

    if (instance.assignee is None):
        em.addCommentSection(None, "Submitted by " + instance.reporter.username + ".\n"
        + "Group/Location: " + group_name + ".\n"     
	    + "Machine Name: " + instance.item.name + ".\n"
	    + "Description: " + "\n" + instance.description + "\n\n"
        + "Steps: " + "\n" + instance.steps + "\n\n"
        + "Attempts: " + "\n" + instance.attempts + "\n\n")
    else:
        em.addCommentSection(None, "Submitted by " + instance.reporter.username + ".\n"
{'fraction_non_alphanumeric': 0.11685994647636039, 'fraction_numerical': 0.0, 'mean_word_length': 2.8577981651376145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '80831', 'n_tokens_mistral': 1029, 'n_tokens_neox': 998, 'n_words': 273}