<commit_before>from common import *

def check_prereg_reqs(attendee):
    if attendee.age_group == AGE_UNKNOWN:
        return "You must select an age category"
    elif attendee.badge_type == PSEUDO_DEALER_BADGE and not attendee.phone:
        return "Your phone number is required"

def check_payment(qs):
    resp = urlopen(PAYPAL_ACTION + "?cmd=_notify-validate&" + qs).read().lower()
    if resp != "verified":
        return "Paypal response {!r} != 'verified'".format(resp)

def check_tables(attendee, group, params):
    if attendee.badge_type == PSEUDO_DEALER_BADGE and group.tables < int(params["badges"]) // 3:
        return "You must get 1 table per 3 badges"

def check_dealer(group):
    if not group.address:
        return "Dealers are required to provide an address for tax purposes"
    elif not group.wares:
        return "You must provide a detail explanation of what you sell for us to evaluate your submission"
    elif not group.website:
        return "Please enter your business' website address"
    elif not group.description:
        return "Please provide a brief description of your business for our website's Confirmed Vendors page"


def cost_and_names(preregs):
    total, names = 0, []
    for attendee in preregs:
        if attendee.paid == NOT_PAID:
            total += attendee.total_cost
            names.append(attendee.full_name)
        elif attendee.group and attendee.group.amount_paid == 0:
            total += attendee.group.total_cost
            names.append(attendee.group.name)
    return (total, ", ".join(names)) if len(names) > 1 else (0, [])

def send_prereg_emails(attendee):
    try:
        sender = REGDESK_EMAIL
        subject = "MAGFest Preregistration"
        message = "Your preregistration will be complete when you pay below"
        if attendee.group:
            if attendee.group.tables:
                sender = MARKETPLACE_EMAIL
                template = "dealer_email.html"
                subject = "MAGFest Dealer Request Submitted"
                if state.DEALER_REG_FULL:
                    message = "Although dealer registration is closed, your dealer request has been added to our waitlist"
                else:
                    message = "Your dealer request has been submitted, we'll email you after your submission is reviewed"
            else:
                template = "group_email.html"
        else:
            template = "attendee_email.html"
        body = render("emails/" + template, {"attendee": attendee})
        send_email(sender, attendee.email, subject, body, format = "html")
        Email.objects.create(fk_tab="Attendee", fk_id=attendee.id, subject=subject, dest=attendee.email, body=body)
        return message
    except:
        log.warning("unable to send prereg confirmation email to {}", attendee.email, exc_info = True)
        return message + ", but the automated confirmation email could not be sent."

def keep_body():
    if cherrypy.request.method == "POST":
        cherrypy.request.process_request_body = False
cherrypy.tools.keep_body = cherrypy.Tool('before_request_body', keep_body)



def send_callback_email(subject, params):
    send_email(REGDESK_EMAIL, REG_EMAILS, subject, repr(params))

def parse_ids(item_num):<commit_msg>changed payment emails to go to the regdesk mailing list<commit_after>from common import *

def check_prereg_reqs(attendee):
    if attendee.age_group == AGE_UNKNOWN:
        return "You must select an age category"
    elif attendee.badge_type == PSEUDO_DEALER_BADGE and not attendee.phone:
        return "Your phone number is required"

def check_payment(qs):
    resp = urlopen(PAYPAL_ACTION + "?cmd=_notify-validate&" + qs).read().lower()
    if resp != "verified":
        return "Paypal response {!r} != 'verified'".format(resp)

def check_tables(attendee, group, params):
    if attendee.badge_type == PSEUDO_DEALER_BADGE and group.tables < int(params["badges"]) // 3:
        return "You must get 1 table per 3 badges"

def check_dealer(group):
    if not group.address:
        return "Dealers are required to provide an address for tax purposes"
    elif not group.wares:
        return "You must provide a detail explanation of what you sell for us to evaluate your submission"
    elif not group.website:
        return "Please enter your business' website address"
    elif not group.description:
        return "Please provide a brief description of your business for our website's Confirmed Vendors page"


def cost_and_names(preregs):
    total, names = 0, []
    for attendee in preregs:
        if attendee.paid == NOT_PAID:
            total += attendee.total_cost
            names.append(attendee.full_name)
        elif attendee.group and attendee.group.amount_paid == 0:
            total += attendee.group.total_cost
            names.append(attendee.group.name)
    return (total, ", ".join(names)) if len(names) > 1 else (0, [])

def send_prereg_emails(attendee):
    try:
        sender = REGDESK_EMAIL
        subject = "MAGFest Preregistration"
        message = "Your preregistration will be complete when you pay below"
        if attendee.group:
            if attendee.group.tables:
                sender = MARKETPLACE_EMAIL
                template = "dealer_email.html"
                subject = "MAGFest Dealer Request Submitted"
                if state.DEALER_REG_FULL:
                    message = "Although dealer registration is closed, your dealer request has been added to our waitlist"
                else:
                    message = "Your dealer request has been submitted, we'll email you after your submission is reviewed"
            else:
                template = "group_email.html"
        else:
            template = "attendee_email.html"
        body = render("emails/" + template, {"attendee": attendee})
        send_email(sender, attendee.email, subject, body, format = "html")
        Email.objects.create(fk_tab="Attendee", fk_id=attendee.id, subject=subject, dest=attendee.email, body=body)
        return message
    except:
        log.warning("unable to send prereg confirmation email to {}", attendee.email, exc_info = True)
        return message + ", but the automated confirmation email could not be sent."

def keep_body():
    if cherrypy.request.method == "POST":
        cherrypy.request.process_request_body = False
cherrypy.tools.keep_body = cherrypy.Tool('before_request_body', keep_body)



def send_callback_email(subject, params):
    send_email(REGDESK_EMAIL, REGDESK_EMAIL, subject, repr(params))

def parse_ids(item_num):
{'fraction_non_alphanumeric': 0.08825319537431528, 'fraction_numerical': 0.002130249543517955, 'mean_word_length': 2.857394366197183, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 5, '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': '7128105', 'n_tokens_mistral': 1936, 'n_tokens_neox': 1881, 'n_words': 578}