@staticmethod
    def sync_task_onvalidation(form):

        repository_id = form.vars.repository_id or \
                        current.request.post_vars.repository_id
        resource_name = form.vars.resource_name

        if repository_id and resource_name:
            ttable = current.s3db.sync_task
            query = (ttable.repository_id == repository_id) & \
                    (ttable.resource_name == resource_name) & \
                    (ttable.deleted != True)
            row = current.db(query).select(ttable.id,
                                           limitby=(0, 1)).first()
            if row:
                form.errors.resource_name = \
                T("This resource is already configured for this repository")

    # -------------------------------------------------------------------------
Task record validation
dataset/ETHPy150Open sahana/eden/modules/s3db/sync.py/SyncDataModel.sync_task_onvalidation