def vocabulary_update(context, data_dict):
 model = context['model']
 vocab_id = data_dict.get('id')
 if (not vocab_id):
  raise ValidationError({'id': _('id not in data')})
 vocab = model.vocabulary.Vocabulary.get(vocab_id)
 if (vocab is None):
  raise NotFound((_('Could not find vocabulary "%s"') % vocab_id))
 data_dict['id'] = vocab.id
 if data_dict.has_key('name'):
  if (data_dict['name'] == vocab.name):
   del data_dict['name']
 _check_access('vocabulary_update', context, data_dict)
 schema = (context.get('schema') or schema_.default_update_vocabulary_schema())
 (data, errors) = _validate(data_dict, schema, context)
 if errors:
  model.Session.rollback()
  raise ValidationError(errors)
 updated_vocab = model_save.vocabulary_dict_update(data, context)
 if (not context.get('defer_commit')):
  model.repo.commit()
 return model_dictize.vocabulary_dictize(updated_vocab, context)

def vocabulary_update ( context , data_dict ) : model = context [ 'model' ] vocab_id = data_dict . get ( 'id' ) if ( not vocab_id ) : raise ValidationError ( { 'id' : _ ( 'id not in data' ) } ) vocab = model . vocabulary . Vocabulary . get ( vocab_id ) if ( vocab is None ) : raise NotFound ( ( _ ( 'Could not find vocabulary "%s"' ) % vocab_id ) ) data_dict [ 'id' ] = vocab . id if data_dict . has_key ( 'name' ) : if ( data_dict [ 'name' ] == vocab . name ) : del data_dict [ 'name' ] _check_access ( 'vocabulary_update' , context , data_dict ) schema = ( context . get ( 'schema' ) or schema_ . default_update_vocabulary_schema ( ) ) ( data , errors ) = _validate ( data_dict , schema , context ) if errors : model . Session . rollback ( ) raise ValidationError ( errors ) updated_vocab = model_save . vocabulary_dict_update ( data , context ) if ( not context . get ( 'defer_commit' ) ) : model . repo . commit ( ) return model_dictize . vocabulary_dictize ( updated_vocab , context )
update a tag vocabulary .