def get_valid_layer_name(layer, overwrite):
 if isinstance(layer, Layer):
  layer_name = layer.name
 elif isinstance(layer, basestring):
  layer_name = layer
 else:
  msg = 'You must pass either a filename or a GeoNode layer object'
  raise GeoNodeException(msg)
 if overwrite:
  return layer_name
 else:
  return get_valid_name(layer_name)

def get_valid_layer_name ( layer , overwrite ) : if isinstance ( layer , Layer ) : layer_name = layer . name elif isinstance ( layer , basestring ) : layer_name = layer else : msg = 'You must pass either a filename or a GeoNode layer object' raise GeoNodeException ( msg ) if overwrite : return layer_name else : return get_valid_name ( layer_name )
checks if the layer is a string and fetches it from the database .