Commit graph

116 commits

Author SHA1 Message Date
Peter Gray
95d899786a Refactor bounding box code
Moved duplicated code into the BoundingBox class, and pass around
BoundingBox objects instead of lists of bounds.
2011-11-14 09:42:57 +00:00
Tom Hughes
fc25c3d412 Rename all ID columns that aren't unique
Having a table with a column called ID that is only part of the
primary key really doesn't work as rails likes to treat ID as a
special name so it becomes impossible to assign to it or read it.
2011-11-14 09:42:52 +00:00
Tom Hughes
8ae5d94b2f Update some more queries to use AREL in place of deprecated methods 2011-11-14 09:42:51 +00:00
Tom Hughes
1da4cecaf6 List all objects that are blocking a delete, in a well defined order 2011-11-14 09:42:49 +00:00
Tom Hughes
226c41be69 Update ActiveRecord queries to use arel 2011-11-14 09:42:44 +00: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
Tom Hughes
291350850d Say which way is too long. 2009-07-15 13:34:14 +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
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
43988beec3 A better optimisation, as suggested by TomH. 2009-05-11 15:16:36 +00:00
Matt Amos
9481a79e71 Added optimisation for way checking. Same method as for relations. 2009-05-11 14:34:04 +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
c273b4b1fa Tests for PreconditionFailed error messages.
Change to relation.rb to bring element selection in-line with that of way, so to return nil to be caught later, rather than raise an error.
Change to way.rb to clarify which way on diff upload.
2009-05-06 21:08:50 +00:00
Thomas Wood
d7fd3fb6e5 One final (I've checked the rest now!) mis-referenced id, plus make the error msg simpler. 2009-05-06 19:55:25 +00:00
Shaun McDonald
d0e16cdb6c be a bit more specific when a way is a member of a relation. Actually return an error message when a relation precondition fails. Remove a debug statement. 2009-05-05 17:07:06 +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
34381e56b7 give a id when a way is a member of a relation 2009-04-30 16:50:20 +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
Shaun McDonald
b7596f7fbc Fix typo of missing .new for some of the errors. Tests are useful. 2009-04-26 20:56:58 +00:00
Matt Amos
eed6fdf7db Fixed bug in exception creation. 2009-04-25 15:20:48 +00:00
Matt Amos
6c66507427 Patching better 412 error messages from mis-commit on old api06 branch. 2009-04-24 10:08:15 +00:00
Matt Amos
9ff7ea8d71 Added better error messages on 412 precondition failed. 2009-04-23 18:39:36 +00:00
Tom Hughes
ff9f596cea Arrays have a length method, not a count method. 2009-04-21 11:36:41 +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
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
Thomas Wood
6167bb6502 Shut up libxml's "Must specify a string with one or more characters" error on relation and way models. 2009-03-23 21:52:32 +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
b051dd11af Making amf controller act more like the xml apis 2008-12-11 17:22:15 +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
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
Shaun McDonald
c8b70c1c72 Adding some more unit test stubs that need filling out. Adding changeset tags fixture. Indentation fix in way model. 2008-11-14 02:06:04 +00:00
Richard Fairhurst
3065af398d 0.6-friendly Potlatch (work in progress). DO NOT SET POTLATCH_USE_SQL=false as it won't work 2008-11-09 23:50:03 +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
Frederik Ramm
5ff5bf60e5 mini fix 2008-11-09 12:06:05 +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
Shaun McDonald
635daf1773 Adding a restriction to prevent more than 2000 nodes to be added to any way. Tests still need to be written. Capabilities api request also updated. 2008-11-03 00:12:18 +00:00