def s3_gis_location_parents(r, **attr):
 table = r.resource.table
 if (not s3_has_permission('read', table)):
  r.unauthorised()
 if (r.representation == 'html'):
  output = dict()
  raise HTTP(501, ERROR.BAD_FORMAT)
 elif (r.representation == 'json'):
  if r.id:
   parents = gis.get_parents(r.id)
   if parents:
    _parents = {}
    for parent in parents:
     _parents[parent.level] = parent.id
    output = json.dumps(_parents, separators=SEPARATORS)
    return output
   else:
    raise HTTP(404, ERROR.NO_MATCH)
  else:
   raise HTTP(404, ERROR.BAD_RECORD)
 else:
  raise HTTP(415, ERROR.BAD_FORMAT)

def s3_gis_location_parents ( r , ** attr ) : table = r . resource . table if ( not s3_has_permission ( 'read' , table ) ) : r . unauthorised ( ) if ( r . representation == 'html' ) : output = dict ( ) raise HTTP ( 501 , ERROR . BAD_FORMAT ) elif ( r . representation == 'json' ) : if r . id : parents = gis . get_parents ( r . id ) if parents : _parents = { } for parent in parents : _parents [ parent . level ] = parent . id output = json . dumps ( _parents , separators = SEPARATORS ) return output else : raise HTTP ( 404 , ERROR . NO_MATCH ) else : raise HTTP ( 404 , ERROR . BAD_RECORD ) else : raise HTTP ( 415 , ERROR . BAD_FORMAT )
custom s3method return a list of parents for a location .