'Form validation'

@staticmethod
def project_organisation_onvalidation(form, lead_role=None):

    if (lead_role is None):
        lead_role = current.deployment_settings.get_project_organisation_lead_role()
    form_vars = form.vars
    project_id = form_vars.project_id
    organisation_id = form_vars.organisation_id
    if ((str(form_vars.role) == str(lead_role)) and project_id):
        db = current.db
        otable = db.project_organisation
        query = ((((otable.deleted != True) & (otable.project_id == project_id)) & (otable.role == lead_role)) & (otable.organisation_id != organisation_id))
        row = db(query).select(otable.id, limitby=(0, 1)).first()
        if row:
            form.errors.role = current.T('Lead    Implementer    for    this    project    is    already    set,    please    choose    another    role.')
