# 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Yith Library Server is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Yith Library Server.  If not, see <http://www.gnu.org/licenses/>.





log = logging.getLogger(__name__)


@view_config(route_name='home', renderer='templates/home.pt')
def home(request):
    return {}


@view_config(route_name='contact', renderer='templates/contact.pt')
def contact(request):
    button1 = Button('submit', _('Send message'))
    button1.css_class = 'btn-primary'
    button2 = Button('cancel', _('Cancel'))
    button2.css_class = ''


# 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

# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Yith Library Server is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Yith Library Server.  If not, see <http://www.gnu.org/licenses/>.





log = logging.getLogger(__name__)


@view_config(route_name='home', renderer='templates/home.pt')
def home(request):
    return {}


@view_config(route_name='contact', renderer='templates/contact.pt')
def contact(request):
    button1 = Button('submit', _('Send message'))
    button1.css_class = 'btn-primary'
    button2 = Button('cancel', _('Cancel'))
    button2.css_class = ''


    form = Form(ContactSchema(), buttons=(button1, button2))