result = putway(renumberednodes, *args)
result[4] = renumberednodes.reject { |k, _v| orn.key?(k) }
renumberedways[result[2]] = result[3] if result[0].zero? && result[2] != result[3]
- when "putrelation" then
+ when "putrelation"
result = putrelation(renumberednodes, renumberedways, *args)
- when "deleteway" then
+ when "deleteway"
result = deleteway(*args)
when "putpoi" then
result = putpoi(*args)
renumberednodes[result[2]] = result[3] if result[0].zero? && result[2] != result[3]
- when "startchangeset" then
+ when "startchangeset"
result = startchangeset(*args)
end
def amf_handle_error(call, rootobj, rootid)
yield
- rescue OSM::APIAlreadyDeletedError => ex
- [-4, ex.object, ex.object_id]
- rescue OSM::APIVersionMismatchError => ex
- [-3, [rootobj, rootid], [ex.type.downcase, ex.id, ex.latest]]
- rescue OSM::APIUserChangesetMismatchError => ex
- [-2, ex.to_s]
- rescue OSM::APIBadBoundingBox => ex
- [-2, "Sorry - I can't get the map for that area. The server said: #{ex}"]
- rescue OSM::APIError => ex
- [-1, ex.to_s]
- rescue StandardError => ex
- [-2, "An unusual error happened (in #{call}). The server said: #{ex}"]
+ rescue OSM::APIAlreadyDeletedError => e
+ [-4, e.object, e.object_id]
+ rescue OSM::APIVersionMismatchError => e
+ [-3, [rootobj, rootid], [e.type.downcase, e.id, e.latest]]
+ rescue OSM::APIUserChangesetMismatchError => e
+ [-2, e.to_s]
+ rescue OSM::APIBadBoundingBox => e
+ [-2, "Sorry - I can't get the map for that area. The server said: #{e}"]
+ rescue OSM::APIError => e
+ [-1, e.to_s]
+ rescue StandardError => e
+ [-2, "An unusual error happened (in #{call}). The server said: #{e}"]
end
def amf_handle_error_with_timeout(call, rootobj, rootid)
loaded_lang = "en"
# Load English defaults
- en = YAML.safe_load(File.open(Rails.root.join("config", "potlatch", "locales", "en.yml")))["en"]
+ en = YAML.safe_load(File.open(Rails.root.join("config/potlatch/locales/en.yml")))["en"]
if lang == "en"
- return [loaded_lang, en]
+ [loaded_lang, en]
else
# Use English as a fallback
begin
- other = YAML.safe_load(File.open(Rails.root.join("config", "potlatch", "locales", "#{lang}.yml")))[lang]
+ other = YAML.safe_load(File.open(Rails.root.join("config/potlatch/locales/#{lang}.yml")))[lang]
loaded_lang = lang
rescue StandardError
other = en
# We have to return a flat list and some of the keys won't be
# translated (probably)
- return [loaded_lang, en.merge(other)]
+ [loaded_lang, en.merge(other)]
end
end
new_relation.members = typedmembers
new_relation.tags = tags
new_relation.visible = visible
- new_relation.changeset_id = changeset_id
+ new_relation.changeset_id = changeset_id.to_i
new_relation.version = version
if relid <= 0
id = renumberednodes[id] if renumberednodes[id]
node = Node.new
- node.changeset_id = changeset_id
+ node.changeset_id = changeset_id.to_i
node.lat = lat
node.lon = lon
node.tags = a[4]
new_way = Way.new
new_way.tags = attributes
new_way.nds = pointlist
- new_way.changeset_id = changeset_id
+ new_way.changeset_id = changeset_id.to_i
new_way.version = wayversion
if originalway <= 0
new_way.create_with_history(user)
deletednodes.each do |id, v|
node = Node.find(id.to_i)
new_node = Node.new
- new_node.changeset_id = changeset_id
+ new_node.changeset_id = changeset_id.to_i
new_node.version = v.to_i
new_node.id = id.to_i
begin
# We always need a new node, based on the data that has been sent to us
new_node = Node.new
- new_node.changeset_id = changeset_id
+ new_node.changeset_id = changeset_id.to_i
new_node.version = version
new_node.lat = lat
new_node.lon = lon
old_way = Way.find(way_id)
delete_way = Way.new
delete_way.version = way_version
- delete_way.changeset_id = changeset_id
+ delete_way.changeset_id = changeset_id.to_i
delete_way.id = way_id
old_way.delete_with_history!(delete_way, user)
deletednodes.each do |id, v|
node = Node.find(id.to_i)
new_node = Node.new
- new_node.changeset_id = changeset_id
+ new_node.changeset_id = changeset_id.to_i
new_node.version = v.to_i
new_node.id = id.to_i
begin
end
def getlocales
- @getlocales ||= Locale.list(Dir.glob(Rails.root.join("config", "potlatch", "locales", "*")).collect { |f| File.basename(f, ".yml") })
+ @getlocales ||= Locale.list(Dir.glob(Rails.root.join("config/potlatch/locales/*")).collect { |f| File.basename(f, ".yml") })
end
##