def pr_add_to_role(role_id, pe_id):
 atable = current.s3db.pr_affiliation
 query = ((atable.role_id == role_id) & (atable.pe_id == pe_id))
 affiliation = current.db(query).select(atable.id, limitby=(0, 1)).first()
 if (affiliation is None):
  atable.insert(role_id=role_id, pe_id=pe_id)
  pr_rebuild_path(pe_id, clear=True)
 return

def pr_add_to_role ( role_id , pe_id ) : atable = current . s3db . pr_affiliation query = ( ( atable . role_id == role_id ) & ( atable . pe_id == pe_id ) ) affiliation = current . db ( query ) . select ( atable . id , limitby = ( 0 , 1 ) ) . first ( ) if ( affiliation is None ) : atable . insert ( role_id = role_id , pe_id = pe_id ) pr_rebuild_path ( pe_id , clear = True ) return
back-end method to add a person entity to a role .