def pr_realm(entity):
 if (not entity):
  return []
 s3db = current.s3db
 atable = s3db.pr_affiliation
 rtable = s3db.pr_role
 query = (((((atable.deleted != True) & (atable.role_id == rtable.id)) & (atable.pe_id == entity)) & (rtable.deleted != True)) & (rtable.role_type == OU))
 rows = current.db(query).select(rtable.pe_id)
 realm = [row.pe_id for row in rows]
 return realm

def pr_realm ( entity ) : if ( not entity ) : return [ ] s3db = current . s3db atable = s3db . pr_affiliation rtable = s3db . pr_role query = ( ( ( ( ( atable . deleted != True ) & ( atable . role_id == rtable . id ) ) & ( atable . pe_id == entity ) ) & ( rtable . deleted != True ) ) & ( rtable . role_type == OU ) ) rows = current . db ( query ) . select ( rtable . pe_id ) realm = [ row . pe_id for row in rows ] return realm
get the default realm of an entity .