Commit graph

136 commits

Author SHA1 Message Date
Tom Hughes
a9ff3bfc4b Remove tags from deleted nodes
When ways or relations are deleted we remove their tags and there
is no reason why nodes should be different.
2011-05-05 20:25:58 +01:00
Tom Hughes
f07819d81a Rework application configuration
Use a preinitializer to load the settings from application.yml so
that they are available as early as possible. All settings can also
be overridden using environment variables.

The ad-hoc settins in environment.rb are then moved to this new
system so we have one consistent location for settings.
2010-08-04 22:06:05 +01:00
Matt Amos
bb84a78a09 Made XML parsing routines raise an exception if the document is valid XML, but not valid as an OSM document. This is now the same behaviour as when the document isn't valid XML. 2009-08-06 17:28:49 +00:00
Shaun McDonald
65eb6af303 Give a nice error message when parsing the nwr tags and they are missing the k and/or v. Also includes tests. 2009-06-11 11:08:37 +00:00
Shaun McDonald
e4d7b3ee66 Throw errors in the way xml parsing if there is a problem. Bring the way parsing in line with the node parsing. Properly deal with the 0 id case. Some Way.from_xml tests. 2009-06-10 15:42:12 +00:00
Shaun McDonald
e3693d487a More unit tests for the parsing of the Node.from_xml. Some code clean up to ensure that a node that cannot be parsed will always throw an exception, to be handled by the arround handler. 2009-06-08 18:53:19 +00:00
Matt Amos
4ab495f5db Added locking around update and delete methods on main API objects. This should remove the 500 errors which come from concurrent overlapping updates. Experimental - might be too slow for production. 2009-05-21 14:57:03 +00:00
Matt Amos
3d0ca940d2 Using an around_handler for catching and rendering errors in most of the API controller methods. This simplifies the code and makes errors and error messages a bit more consistent. Also added a utility method for checking the HTTP method. 2009-05-20 17:39:59 +00:00
Matt Amos
b7f306a437 Fixed problem where tag lengths were generating a 422 error with no message. They now generate a 400 error with a meaningful message. 2009-05-10 00:33:55 +00:00
Thomas Wood
1d48f48827 Fix another mis-referenced error message id! 2009-05-02 18:28:39 +00:00
Tom Hughes
329b6faf91 Use association names with :joins instead of writing the SQL for the
join by hand.
2009-04-30 23:45:55 +00:00
Shaun McDonald
33d32bf737 We don't need an extra method for the amf controller for saving nodes, just catch the exception and do nothing with that exception. 2009-04-30 15:16:15 +00:00
Thomas Wood
2861236f60 Fix another error reporting bug similar to previous, again on printing RelationMember.id rather than RelationMember.relation.id 2009-04-30 07:10:57 +00:00
Richard Fairhurst
41f85fb77d Potlatch 0.11a 2009-04-30 01:23:50 +00:00
Matt Amos
3e9b6845d3 Fixed 'raw' raises by converting them to the appropriate OSM::APIError type. Made the error messages for placeholder fixing more informative. Added tests for these. 2009-04-29 10:07:35 +00:00
Tom Hughes
bf31791f65 Add a changeset cache to stop us looking up the same changeset over
and over again when processing a map call.
2009-04-28 13:40:30 +00:00
Shaun McDonald
0b6d9ce877 Improve the node/way/relation already deleted error message, and get rid bug in way model with missing new in exception 2009-04-27 11:49:56 +00:00
Matt Amos
82a54db3d9 Fixed dumb copy-and-paste mistake. 2009-04-24 18:47:41 +00:00
Matt Amos
9ff7ea8d71 Added better error messages on 412 precondition failed. 2009-04-23 18:39:36 +00:00
Shaun McDonald
08bd1688ee Railsify the relation member model, type attribute, by putting it into class case, rather than lower case. Requires reload of postgres databases or manual change to the enum. Fixes the databrowser on postgres, however affects the rest of the codebase. 2009-04-15 14:49:21 +00:00
Thomas Wood
6442208841 Add exceptions for remaing cases where XML::Parser.string is used, to catch for empty strings.
See also r14241
2009-04-09 22:37:43 +00:00
Matt Amos
18633b7c9e Fixed a problem where rails was setting the ID column to null, which violates the not-null constraint. Also fixed possible typo in AMF controller. 2009-03-29 02:14:40 +00:00
Matt Amos
afcb345014 Moved a bunch of time functions into UTC. Fixes bugs which we only see for 4 hours a year. 2009-03-29 01:31:04 +00:00
Matt Amos
be75a1504f Fixed a couple of bugs with changeset bounding box calculation when modifying or deleting. 2009-03-27 12:22:23 +00:00
Tom Hughes
c8ee135104 Merge 12304:14009 from trunk. 2009-03-08 13:02:37 +00:00
Tom Hughes
07c1cd6b98 Update to use libxml 1.0.0 gem. 2009-03-08 11:34:46 +00:00
Shaun McDonald
b7335940e2 Some improvements for the XML parsing, as there are somethings that we don't need, like timestamp and visibility, thus hopefully bringing a speedup in the xml parsing. Some more AMF controller fixes, plenty more to go though. 2008-12-09 18:44:11 +00:00
Shaun McDonald
c0b4c1b905 Adding some amf create poi tests. Minor bugfix tweaks to the amf controller 2008-12-08 14:22:34 +00:00
Shaun McDonald
e9527b363d Refactoring the amf controller, and all models so that save_with_history! is now private. Everyone should use create_with_history, delete_with_history, and update_from instead. Also gets the amf controller to do version checks in the node/way/relation models. Needs checked. This breaks Potlatch until #1376 is fixed. 2008-12-04 17:30:17 +00:00
Shaun McDonald
e989b1a880 ensure that uploads that don't supply a lat and lon for a node. Adding related test and fixing other tests. 2008-12-01 18:32:54 +00:00
Shaun McDonald
6e98e324e5 better handling of duplicate tags. Extra validation in the tests. 2008-11-28 17:38:23 +00:00
Matt Amos
299b671522 Moved transaction boundary to cover used-by tests on deletion so that the database can help prevent race conditions. 2008-11-26 14:49:56 +00:00
Shaun McDonald
1375095343 More model validations. Fixing one test. 2008-11-25 17:23:47 +00:00
Matt Amos
a90be5e69a Migration to add close-time to changesets. This replaces the boolean 'open' attribute. Added checks to ensure that the maximum lifetime and number of changes in a changeset are enforced. Added some tests. 2008-11-17 19:00:01 +00:00
Matt Amos
e79fd07638 Made relations ordered. Added some tests for this. Otherwise interface is unchanged. 2008-11-10 15:41:05 +00:00
Dave Stubbs
322d293007 update nodes/ways/relation XML to include user id as well as display name 2008-11-09 16:43:09 +00:00
Matt Amos
b875d14b7c Added a query method for querying bounding boxes, times and users of changesets. Needs (much) more testing. 2008-11-07 18:24:34 +00:00
Andy Allan
c253ce3399 some boolean correctness work 2008-11-07 13:51:09 +00:00
Andy Allan
7058d836f7 use boolean flags when using boolean columns 2008-11-07 13:24:18 +00:00
Matt Amos
02fbcf5f06 Added first attempt at bounding box support in changesets and tests for the same. 2008-11-04 15:52:22 +00:00
Matt Amos
dc2a959037 Added tests for changeset upload code. Refactored diff reading code and put it into /lib. Changed the route of a changeset upload to explicitly refer to the changeset it applies to (i.e: resource). 2008-10-23 15:14:17 +00:00
Matt Amos
b56f57ec43 Fixed up delete methods on nodes, ways and relations to return the new version number and added some more tests. 2008-10-14 14:27:12 +00:00
Matt Amos
cf24a5a3ee Added a bunch more tests on the API 0.6. Fixed node/way/relation from_xml code to disallow duplicate tag keys. 2008-10-13 17:50:15 +00:00
Shaun McDonald
fb5f39f19a Creating consistency check for creation of nodes, way and relations. Moving some creation code from the controller to the model, and adding error handling on create errors. 2008-10-13 15:39:21 +00:00
Shaun McDonald
b91b514cf2 moving the check consistency to it's own file so that checks will be able to be loaded into the way and relation models, without loading the node stuff. 2008-10-13 14:34:04 +00:00
Shaun McDonald
3d24694add moving the conistency checks for updates and deletes to library, hopefully got the updates and deletes working now. 2008-10-09 16:22:05 +00:00
Shaun McDonald
2b7a40069f adding the controller code to be able to get a specific version of a node, way or relation. Add some node checks on update. Some code indentation cleanup. 2008-10-08 18:03:41 +00:00
Shaun McDonald
e1b205913c Fix the data config, so that the development database is not the same as the test database. Make a good stab at getting the creates and updates for relations working, adding some new error exceptions. Some code indentation cleanup. 2008-10-08 15:42:42 +00:00
Shaun McDonald
328d47e506 Fixing a bug in my foreign keys. I can now upload and download nodes and ways using JOSM in the new API. 2008-10-03 17:09:58 +00:00
Shaun McDonald
40414cf324 changing the belongs_to and has_many items in the models to reflect the new foriegn keys in the db and the fact that a (old)node/way/relation now belong to a changeset, which in turn has a user. 2008-09-30 18:21:56 +00:00