'If strict, hierarchy names must not have gaps.'

@staticmethod
def gis_hierarchy_onvalidation(form):

    form_vars = form.vars
    if form_vars.strict_hierarchy:
        gis = current.gis
        hierarchy_level_keys = gis.hierarchy_level_keys
        level_names = [(form_vars[key] if (key in form_vars) else None) for key in hierarchy_level_keys]
        gaps = filter(None, map((lambda n: ((not level_names[n]) and level_names[(n + 1)] and ('L%d' % n))), range(1, gis.max_allowed_level_num)))
        if gaps:
            hierarchy_gap = current.T('A    strict    location    hierarchy    cannot    have    gaps.')
            for gap in gaps:
                form.errors[gap] = hierarchy_gap
