def gis_hierarchy_editable(level, id):
 country = current.gis.get_parent_country(id)
 s3db = current.s3db
 table = s3db.gis_hierarchy
 fieldname = ('edit_%s' % level)
 query = (table.uuid == 'SITE_DEFAULT')
 if country:
  query |= (table.location_id == country)
  limitby = (0, 2)
 else:
  limitby = (0, 1)
 rows = current.db(query).select(table[fieldname], table.uuid, limitby=limitby, cache=s3db.cache)
 if (len(rows) > 1):
  filter = (lambda row: (row.uuid == 'SITE_DEFAULT'))
  rows.exclude(filter)
 row = rows.first()
 editable = row[fieldname]
 return editable

def gis_hierarchy_editable ( level , id ) : country = current . gis . get_parent_country ( id ) s3db = current . s3db table = s3db . gis_hierarchy fieldname = ( 'edit_%s' % level ) query = ( table . uuid == 'SITE_DEFAULT' ) if country : query |= ( table . location_id == country ) limitby = ( 0 , 2 ) else : limitby = ( 0 , 1 ) rows = current . db ( query ) . select ( table [ fieldname ] , table . uuid , limitby = limitby , cache = s3db . cache ) if ( len ( rows ) > 1 ) : filter = ( lambda row : ( row . uuid == 'SITE_DEFAULT' ) ) rows . exclude ( filter ) row = rows . first ( ) editable = row [ fieldname ] return editable
returns the edit_<level> value from the parent country hierarchy .