# Path: yithlibraryserver/email.py
# def send_email_to_admins(request, template, context, subject,
#                          attachments=None, extra_headers=None):
#     admin_emails = request.registry.settings['admin_emails']
#     if admin_emails:
#         return send_email(request, template, context, subject, admin_emails,
#                           attachments, extra_headers)
# 
# Path: yithlibraryserver/i18n.py
# def deform_translator(term):
# def locale_negotiator(request):
# 
# Path: yithlibraryserver/schemas.py
# class ContactSchema(colander.MappingSchema):
# 
#     name = colander.SchemaNode(colander.String(), title=_('Name'))
#     email = colander.SchemaNode(colander.String(), title=_('Email'))
#     message = colander.SchemaNode(
#         colander.String(),
#         widget=TextAreaWidget(css_class='input-xxlarge', rows=10),
#         title=_('Message'),
#         )


import logging
from deform import Button, Form, ValidationFailure
from pyramid.i18n import get_locale_name
from pyramid.httpexceptions import HTTPFound
from pyramid.renderers import render_to_response
from pyramid.view import view_config
from yithlibraryserver.email import send_email_to_admins
from yithlibraryserver.i18n import TranslationString as _
from yithlibraryserver.schemas import ContactSchema
        controls = request.POST.items()
        try:
            appstruct = form.validate(controls)
        except ValidationFailure as e:
            return {'form': e.render()}

        context = {'link': request.route_url('contact')}
        context.update(appstruct)
        subject= ("%s sent a message from Yith's contact form"
                  % appstruct['name'])

        result = send_email_to_admins(
            request,
            'yithlibraryserver:templates/email_contact',
            context,
            subject,
            extra_headers={'Reply-To': appstruct['email']},
        )

        if result is None:
            log.error(
                '%s <%s> tried to send a message from the contact form but no '
                'admin emails were configured. Message: %s' % (
                    appstruct['name'],
                    appstruct['email'],
                    appstruct['message'],
                    )
                )

        request.session.flash(

# Path: yithlibraryserver/email.py
# def send_email_to_admins(request, template, context, subject,
#                          attachments=None, extra_headers=None):
#     admin_emails = request.registry.settings['admin_emails']
#     if admin_emails:
#         return send_email(request, template, context, subject, admin_emails,
#                           attachments, extra_headers)
# 
# Path: yithlibraryserver/i18n.py
# def deform_translator(term):
# def locale_negotiator(request):
# 
# Path: yithlibraryserver/schemas.py
# class ContactSchema(colander.MappingSchema):
# 
#     name = colander.SchemaNode(colander.String(), title=_('Name'))
#     email = colander.SchemaNode(colander.String(), title=_('Email'))
#     message = colander.SchemaNode(
#         colander.String(),
#         widget=TextAreaWidget(css_class='input-xxlarge', rows=10),
#         title=_('Message'),
#         )


# Path: yithlibraryserver/views.py
import logging
from deform import Button, Form, ValidationFailure
from pyramid.i18n import get_locale_name
from pyramid.httpexceptions import HTTPFound
from pyramid.renderers import render_to_response
from pyramid.view import view_config
from yithlibraryserver.email import send_email_to_admins
from yithlibraryserver.i18n import TranslationString as _
from yithlibraryserver.schemas import ContactSchema

        controls = request.POST.items()
        try:
            appstruct = form.validate(controls)
        except ValidationFailure as e:
            return {'form': e.render()}

        context = {'link': request.route_url('contact')}
        context.update(appstruct)
        subject= ("%s sent a message from Yith's contact form"
                  % appstruct['name'])

        result = send_email_to_admins(
            request,
            'yithlibraryserver:templates/email_contact',
            context,
            subject,
            extra_headers={'Reply-To': appstruct['email']},
        )

        if result is None:
            log.error(
                '%s <%s> tried to send a message from the contact form but no '
                'admin emails were configured. Message: %s' % (
                    appstruct['name'],
                    appstruct['email'],
                    appstruct['message'],
                    )
                )

        request.session.flash(

            _('Thank you very much for sharing your opinion'),