Change the way that the changeset parsing is done, so that it is in line with the nodes/ways/relations and gives much nicer error messages. Adding some tests too to back up those changes.

This commit is contained in:
Shaun McDonald 2009-12-06 02:13:30 +00:00
parent fe21e55549
commit 43a28065b1
4 changed files with 122 additions and 23 deletions

View file

@ -28,13 +28,10 @@ class ChangesetController < ApplicationController
cs = Changeset.from_xml(request.raw_post, true)
if cs
cs.user_id = @user.id
cs.save_with_tags!
render :text => cs.id.to_s, :content_type => "text/plain"
else
raise OSM::APIBadXMLError.new(Changeset, request.raw_post);
end
# Assume that Node.from_xml has thrown an exception if there is an error parsing the xml
cs.user_id = @user.id
cs.save_with_tags!
render :text => cs.id.to_s, :content_type => "text/plain"
end
##