# Path: yithlibraryserver/i18n.py
# def deform_translator(term):
# def locale_negotiator(request):


import colander
from deform.widget import CheckboxWidget, TextAreaWidget, TextInputWidget
from yithlibraryserver.i18n import TranslationString as _

    email_verified_template = 'email_verified'

    def serialize(self, field, cstruct, readonly=False):
        email_output = super(EmailWidget, self).serialize(
            field,
            cstruct.get('email', ''),
            readonly,
            )

        pstruct = field.schema.deserialize(cstruct)
        email_verified_output = field.renderer(
            self.email_verified_template,
            email=pstruct.get('email', ''),
            email_verified=pstruct.get('email_verified', False),
            )

        return email_output + email_verified_output

    def deserialize(self, field, pstruct):
        return {
            'email': super(EmailWidget, self).deserialize(field, pstruct),
            # The email_verified attr is readonly and
            # thus, not used in the view
            'email_verified': None,
            }


class EmailSchema(colander.MappingSchema):


# Path: yithlibraryserver/i18n.py
# def deform_translator(term):
# def locale_negotiator(request):


# Path: yithlibraryserver/user/schemas.py
import colander
from deform.widget import CheckboxWidget, TextAreaWidget, TextInputWidget
from yithlibraryserver.i18n import TranslationString as _


    email_verified_template = 'email_verified'

    def serialize(self, field, cstruct, readonly=False):
        email_output = super(EmailWidget, self).serialize(
            field,
            cstruct.get('email', ''),
            readonly,
            )

        pstruct = field.schema.deserialize(cstruct)
        email_verified_output = field.renderer(
            self.email_verified_template,
            email=pstruct.get('email', ''),
            email_verified=pstruct.get('email_verified', False),
            )

        return email_output + email_verified_output

    def deserialize(self, field, pstruct):
        return {
            'email': super(EmailWidget, self).deserialize(field, pstruct),
            # The email_verified attr is readonly and
            # thus, not used in the view
            'email_verified': None,
            }


class EmailSchema(colander.MappingSchema):


    email = colander.SchemaNode(colander.String(), missing='')