def resource_view_update(context, data_dict):
 model = context['model']
 id = _get_or_bust(data_dict, 'id')
 resource_view = model.ResourceView.get(id)
 if (not resource_view):
  raise NotFound
 view_plugin = ckan.lib.datapreview.get_view_plugin(resource_view.view_type)
 schema = (context.get('schema') or schema_.default_update_resource_view_schema(view_plugin))
 plugin_schema = view_plugin.info().get('schema', {})
 schema.update(plugin_schema)
 (data, errors) = _validate(data_dict, schema, context)
 if errors:
  model.Session.rollback()
  raise ValidationError(errors)
 context['resource_view'] = resource_view
 context['resource'] = model.Resource.get(resource_view.resource_id)
 _check_access('resource_view_update', context, data_dict)
 if context.get('preview'):
  return data
 resource_view = model_save.resource_view_dict_save(data, context)
 if (not context.get('defer_commit')):
  model.repo.commit()
 return model_dictize.resource_view_dictize(resource_view, context)

def resource_view_update ( context , data_dict ) : model = context [ 'model' ] id = _get_or_bust ( data_dict , 'id' ) resource_view = model . ResourceView . get ( id ) if ( not resource_view ) : raise NotFound view_plugin = ckan . lib . datapreview . get_view_plugin ( resource_view . view_type ) schema = ( context . get ( 'schema' ) or schema_ . default_update_resource_view_schema ( view_plugin ) ) plugin_schema = view_plugin . info ( ) . get ( 'schema' , { } ) schema . update ( plugin_schema ) ( data , errors ) = _validate ( data_dict , schema , context ) if errors : model . Session . rollback ( ) raise ValidationError ( errors ) context [ 'resource_view' ] = resource_view context [ 'resource' ] = model . Resource . get ( resource_view . resource_id ) _check_access ( 'resource_view_update' , context , data_dict ) if context . get ( 'preview' ) : return data resource_view = model_save . resource_view_dict_save ( data , context ) if ( not context . get ( 'defer_commit' ) ) : model . repo . commit ( ) return model_dictize . resource_view_dictize ( resource_view , context )
update a resource view .