<commit_before># This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from collections import namedtuple

from django.core.mail import EmailMessage

import basket
import jingo
import requests
from jinja2.exceptions import TemplateNotFound

from lib.l10n_utils.dotlang import _lazy as _


fa = namedtuple('FunctionalArea', ['id', 'name', 'subject', 'contacts'])
LANG_FILES = 'mozorg/contribute/index'
FUNCTIONAL_AREAS = (
    fa('support',
        _('Helping Users'),
        'Support',
        ['<EMAIL>'],
    ),
    fa('qa',
        _('Testing and QA'),
        'QA',
        ['<EMAIL>'],
    ),
    fa('coding',
        _('Coding'),
        'Coding',
        ['<EMAIL>'],
    ),
    fa('marketing',
        _('Marketing'),
        'Marketing',
        ['<EMAIL>'],
    ),
    fa('localization',
        _('Localization and Translation'),
        'Localization',
        ['<EMAIL>', '<EMAIL>', '<EMAIL>'],
    ),
    fa('webdev',
        _('Web Development'),
        'Webdev',
        ['<EMAIL>'],
    ),
    fa('marketplace',
        _('Firefox Marketplace'),
        'Firefox Marketplace',
        ['<EMAIL>'],
    ),
    fa('addons',
        _('Add-ons'),
        'Add-ons',
        ['<EMAIL>'],
    ),
    fa('design',
        _('Visual Design'),
        'Design',
        ['<EMAIL>'],
    ),
    fa('documentation',
        _('Documentation and Writing'),
        'Documentation',
        ['<EMAIL>'],
    ),
    fa('education',
        _('Education'),
        'Education',
        ['<EMAIL>'],
    ),
    fa('other',
        _('Other'),
        '',
        ['<EMAIL>'],
    ),
    fa('suggestions',
        _('I have a suggestion for Firefox'),
        'Firefox Suggestions',
        [],
    ),
    fa('issues',
        _('I need help with a Firefox issue'),
        'Firefox issue',
        [],
    ),
)

INTEREST_CHOICES = (('', _('Area of interest?')),) + tuple(
                    (area.id, area.name) for area in FUNCTIONAL_AREAS)
FUNCTIONAL_AREAS_DICT = dict((area.id, area) for area in FUNCTIONAL_AREAS)

LOCALE_CONTACTS = {
    'ar': ['<EMAIL>'],
    'bg': ['<EMAIL>'],
    'bn-BD': ['<EMAIL>'],
    'cs': ['<EMAIL>'],
    'cy': ['<EMAIL>'],
    'de': ['<EMAIL>'],
    'dsb': ['<EMAIL>'],
    'el': ['<EMAIL>'],
    'en-GB': ['<EMAIL>'],
    'es-AR': ['<EMAIL>'],
    'es-CL': ['<EMAIL>'],
    'es-ES': ['<EMAIL>'],
    'es-MX': ['<EMAIL>'],
    'fr': ['<EMAIL>'],
    'fy-NL': ['<EMAIL>'],
    'hr': ['<EMAIL>'],
    'hsb': ['<EMAIL>'],
    'id': ['<EMAIL>'],
    'it': ['<EMAIL>'],
    'lt': ['<EMAIL>'],
    'ms': ['<EMAIL>'],
    'nl': ['<EMAIL>'],
    'pl': ['<EMAIL>'],
    'pt-BR': ['<EMAIL>'],
    'ro': ['<EMAIL>'],
    'ru': ['<EMAIL>'],
    'sl': ['<EMAIL>'],
    'son': ['<EMAIL>'],
    'sq': ['<EMAIL>'],
    'sr': ['<EMAIL>'],
    'sv-SE': ['<EMAIL>'],
    'ta': ['<EMAIL>'],
    'tr': ['<EMAIL>'],
    'uk': ['<EMAIL>'],
    'zh-CN': ['<EMAIL>'],
    'zh-TW': ['<EMAIL>'],
}


def handle_form(request, form):
    if form.is_valid():
        data = form.cleaned_data
        send(request, data)
        autorespond(request, data)

        if data.get('newsletter', False):
            if data.get('interest', False) == 'education':
                # custom-1788 is the privacy policy checkbox on this page
                payload = {'email': data['email'], 'custom-1788': '1'}
                try:
                    requests.post('https://sendto.mozilla.org/page/s/mentor-signup',<commit_msg>Bug 1213179 - [pt-PT] Set up email address for contribute page<commit_after># This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from collections import namedtuple

from django.core.mail import EmailMessage

import basket
import jingo
import requests
from jinja2.exceptions import TemplateNotFound

from lib.l10n_utils.dotlang import _lazy as _


fa = namedtuple('FunctionalArea', ['id', 'name', 'subject', 'contacts'])
LANG_FILES = 'mozorg/contribute/index'
FUNCTIONAL_AREAS = (
    fa('support',
        _('Helping Users'),
        'Support',
        ['<EMAIL>'],
    ),
    fa('qa',
        _('Testing and QA'),
        'QA',
        ['<EMAIL>'],
    ),
    fa('coding',
        _('Coding'),
        'Coding',
        ['<EMAIL>'],
    ),
    fa('marketing',
        _('Marketing'),
        'Marketing',
        ['<EMAIL>'],
    ),
    fa('localization',
        _('Localization and Translation'),
        'Localization',
        ['<EMAIL>', '<EMAIL>', '<EMAIL>'],
    ),
    fa('webdev',
        _('Web Development'),
        'Webdev',
        ['<EMAIL>'],
    ),
    fa('marketplace',
        _('Firefox Marketplace'),
        'Firefox Marketplace',
        ['<EMAIL>'],
    ),
    fa('addons',
        _('Add-ons'),
        'Add-ons',
        ['<EMAIL>'],
    ),
    fa('design',
        _('Visual Design'),
        'Design',
        ['<EMAIL>'],
    ),
    fa('documentation',
        _('Documentation and Writing'),
        'Documentation',
        ['<EMAIL>'],
    ),
    fa('education',
        _('Education'),
        'Education',
        ['<EMAIL>'],
    ),
    fa('other',
        _('Other'),
        '',
        ['<EMAIL>'],
    ),
    fa('suggestions',
        _('I have a suggestion for Firefox'),
        'Firefox Suggestions',
        [],
    ),
    fa('issues',
        _('I need help with a Firefox issue'),
        'Firefox issue',
        [],
    ),
)

INTEREST_CHOICES = (('', _('Area of interest?')),) + tuple(
                    (area.id, area.name) for area in FUNCTIONAL_AREAS)
FUNCTIONAL_AREAS_DICT = dict((area.id, area) for area in FUNCTIONAL_AREAS)

LOCALE_CONTACTS = {
    'ar': ['<EMAIL>'],
    'bg': ['<EMAIL>'],
    'bn-BD': ['<EMAIL>'],
    'cs': ['<EMAIL>'],
    'cy': ['<EMAIL>'],
    'de': ['<EMAIL>'],
    'dsb': ['<EMAIL>'],
    'el': ['<EMAIL>'],
    'en-GB': ['<EMAIL>'],
    'es-AR': ['<EMAIL>'],
    'es-CL': ['<EMAIL>'],
    'es-ES': ['<EMAIL>'],
    'es-MX': ['<EMAIL>'],
    'fr': ['<EMAIL>'],
    'fy-NL': ['<EMAIL>'],
    'hr': ['<EMAIL>'],
    'hsb': ['<EMAIL>'],
    'id': ['<EMAIL>'],
    'it': ['<EMAIL>'],
    'lt': ['<EMAIL>'],
    'ms': ['<EMAIL>'],
    'nl': ['<EMAIL>'],
    'pl': ['<EMAIL>'],
    'pt-BR': ['<EMAIL>'],
    'pt-PT': ['<EMAIL>'],
    'ro': ['<EMAIL>'],
    'ru': ['<EMAIL>'],
    'sl': ['<EMAIL>'],
    'son': ['<EMAIL>'],
    'sq': ['<EMAIL>'],
    'sr': ['<EMAIL>'],
    'sv-SE': ['<EMAIL>'],
    'ta': ['<EMAIL>'],
    'tr': ['<EMAIL>'],
    'uk': ['<EMAIL>'],
    'zh-CN': ['<EMAIL>'],
    'zh-TW': ['<EMAIL>'],
}


def handle_form(request, form):
    if form.is_valid():
        data = form.cleaned_data
        send(request, data)
        autorespond(request, data)

        if data.get('newsletter', False):
            if data.get('interest', False) == 'education':
                # custom-1788 is the privacy policy checkbox on this page
                payload = {'email': data['email'], 'custom-1788': '1'}
                try:
                    requests.post('https://sendto.mozilla.org/page/s/mentor-signup',
{'fraction_non_alphanumeric': 0.2295967853678814, 'fraction_numerical': 0.005403907440764861, 'mean_word_length': 2.2690217391304346, 'pattern_counts': {'":': 0, '<': 104, '<?xml version=': 0, '>': 104, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5505804', 'n_tokens_mistral': 2622, 'n_tokens_neox': 2545, 'n_words': 552}