Project

General

Profile

« Previous | Next » 

Revision 3d58e226

Added by Marc Dequènes over 15 years ago

  • ID 3d58e22672318af63b3682a7a89766525a7355fa

[fix] fs aspect primaryGroup corrected, and now handle single-valued relation data, and btw disallow adding the same value multiple times

View differences:

bin/shadowwalker
raise WeirdError, _("Ambiguous item '%s' for relation '%s' (%s possible items)") %
[val, field, foreign_item_list.size]
end
old_val = item.send(field)
val = foreign_item_list.first
when ''
case field
......
if type == '' and field == 'aspects'
raise PreProcessingError, _("The equality operator is not possible for aspects")
end
item.send(field + "=", [val])
val = [val] if old_val.is_a? Enumerable
item.send(field + "=", val)
when '+='
case type
when nil
if attr_info.single_value?
raise PreProcessingError, _("The field '%s' cannot hold more than one value") % field
end
new_val = old_val << val
item.send(field + "=", new_val)
unless old_val.include?(val)
new_val = old_val << val
item.send(field + "=", new_val)
end
when 'rel'
if rel_info[:single_value]
raise PreProcessingError, _("The relation '%s' cannot hold more than one foreign item") % field
end
item.send(field) << val
unless old_val.include?(val)
item.send(field) << val
end
when ''
case field
when 'aspects'
......
if modification_done
missing_fields = item.missing_attributes
### temporarily deactivated
# It is needed to test preliminary work on hooks.
# This check should be moved into the save() method, raise an exception is any problem,
# and exceptions caught in a centralized place in this file.
missing_fields = []
unless missing_fields.empty?
miss_str = []
missing_fields.each do |field|
......
miss_str.join(", ")
end
$program_options[:skip_binary] = true
Display.display_item(item, $program_options)
item.save!
puts "Modification done."
else
puts "Nothing to do."

Also available in: Unified diff