Пример #1
0
    def validateOrganizationOrFullname(data):
        if data.organization or (data.firstname and data.lastname):
            return None

        raise NoOrganizationOrFullname(
            _(
                u"validation_error_organization_or_name_required",
                default=u"Either the name of the organization or first- " u"and lastname of the person is required.",
            )
        )
Пример #2
0
from zope import schema
from zope.interface import implements
from zope.interface import Invalid
from zope.interface import invariant
from zope.schema.vocabulary import SimpleTerm
from zope.schema.vocabulary import SimpleVocabulary


class NoOrganizationOrFullname(Invalid):
    """The organization or fullname is invalid
    """


gender_choice_vocabulary = SimpleVocabulary(
    [
        SimpleTerm(value=u"m", title=_(u"label_male", default=u"Male")),
        SimpleTerm(value=u"f", title=_(u"label_female", default=u"Female")),
        SimpleTerm(value=u"", title=_(u"label_gender_neutral", default=u"-")),
    ]
)


class IContactSchema(model.Schema):
    """A contact type schema interface
    """

    dexteritytextindexer.searchable("organization")
    organization = schema.TextLine(
        title=_(u"label_organization", default=u"Organization"), missing_value=u"", default=u"", required=False
    )