def layer_from_viewer_config(model, layer, source, ordering):
 layer_cfg = dict(layer)
 for k in ['format', 'name', 'opacity', 'styles', 'transparent', 'fixed', 'group', 'visibility', 'source', 'getFeatureInfo']:
  if (k in layer_cfg):
   del layer_cfg[k]
 source_cfg = dict(source)
 for k in ['url', 'projection']:
  if (k in source_cfg):
   del source_cfg[k]
 return model(stack_order=ordering, format=layer.get('format', None), name=layer.get('name', None), opacity=layer.get('opacity', 1), styles=layer.get('styles', None), transparent=layer.get('transparent', False), fixed=layer.get('fixed', False), group=layer.get('group', None), visibility=layer.get('visibility', True), ows_url=source.get('url', None), layer_params=json.dumps(layer_cfg), source_params=json.dumps(source_cfg))

def layer_from_viewer_config ( model , layer , source , ordering ) : layer_cfg = dict ( layer ) for k in [ 'format' , 'name' , 'opacity' , 'styles' , 'transparent' , 'fixed' , 'group' , 'visibility' , 'source' , 'getFeatureInfo' ] : if ( k in layer_cfg ) : del layer_cfg [ k ] source_cfg = dict ( source ) for k in [ 'url' , 'projection' ] : if ( k in source_cfg ) : del source_cfg [ k ] return model ( stack_order = ordering , format = layer . get ( 'format' , None ) , name = layer . get ( 'name' , None ) , opacity = layer . get ( 'opacity' , 1 ) , styles = layer . get ( 'styles' , None ) , transparent = layer . get ( 'transparent' , False ) , fixed = layer . get ( 'fixed' , False ) , group = layer . get ( 'group' , None ) , visibility = layer . get ( 'visibility' , True ) , ows_url = source . get ( 'url' , None ) , layer_params = json . dumps ( layer_cfg ) , source_params = json . dumps ( source_cfg ) )
parse an object out of a parsed layer configuration from a gxp viewer .