google-code-export / marinemap

Automatically exported from code.google.com/p/marinemap
Other
1 stars 2 forks source link

Convert all feature links to use uids. #481

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently there are some inconsistencies in the ids expected by various 
urls/links. The 'built-in' urls are looking for pks while regular links use a 
comma-separated list of feature uids. All feature urls should use the feature 
uids to identify feature(s).

This will mean converting some views to use uids instead of pks. A utility 
function to parse out the uid might be handy.

The link representation in the workspace doc should be standardized to use 
{uid} or {uid+} 

Original issue reported on code.google.com by perrygeo...@gmail.com on 15 Mar 2011 at 10:49

GoogleCodeExporter commented 9 years ago
There is a get_feature_by_uid in features/__init__.py that I used in some of 
the views I think, but it doesn't have support for get_something_or_404 type 
functionality.

Original comment by underbluewaters on 16 Mar 2011 at 4:24

GoogleCodeExporter commented 9 years ago
I modified the lincod.feature.views.get_object_for_* functions to take uids 
which wrap the get_feature_by_uid in a convenient httpresponse-friendly way. 

The urls to all links have been updated to accept only a uid or a 
comma-seperated list of uids.

The workspace json will use the following placeholders:
{uid} = a single feature uid (e.g. mlpa_mpa_12)
{uid+} = multiple feature uids to act on (e.g. mlpa_mpa_12,mlpa_mpa_13 )
{collection_uid} = a single uid for the collection to act on; used when the url 
must indicate the collection as well as other features (e.g. add and remove)

The tests have all been updated and everything seems to work fine. As long as 
there are no hardcoded urls using pks, we should be set.

Original comment by perrygeo...@gmail.com on 16 Mar 2011 at 11:08