[google-appengine] Re: Creating a short unique URL for an entity

2009-01-12 Thread Anthony
http://groups.google.com/group/google-appengine/browse_thread/thread/517a9ad5edd263d2/67a5160882462463?lnk=gst&q=are+ids+unique#67a5160882462463 http://code.google.com/appengine/docs/datastore/keysandentitygroups.html#Entity_Groups_Ancestors_and_Paths Looks like they are unique for a given kind

[google-appengine] Re: Creating a short unique URL for an entity

2009-01-12 Thread Jesse Grosjean
> You could use the id instead of the key, key().id, then you can get it > back with just DocModel.get_by_id(id) > > You should be able to go straight to the doc without the parent > account id /doc/12345 > > I'm not sure you can guarantee id uniqueness across your whole data > store, but it shoul

[google-appengine] Re: Creating a short unique URL for an entity

2009-01-11 Thread Bill
Why worry about risk of collision when you can generate relatively short urls using the Kind string and the id of the entity? Here's one of the first recipes in the cookbook: http://appengine-cookbook.appspot.com/recipe/mapping-keys-to-urls On Jan 11, 5:21 pm, Mahmoud wrote: > Just create a ra

[google-appengine] Re: Creating a short unique URL for an entity

2009-01-11 Thread Mahmoud
Just create a random n-character string for each document. Do that in put() before the entity is saved for the first time. Choose n based on what risk of collision (two documents having the same randomly generated slug) is practical. I say n=6 is pretty good. On Jan 10, 10:24 am, Jesse Grosjean

[google-appengine] Re: Creating a short unique URL for an entity

2009-01-10 Thread Anthony
You could use the id instead of the key, key().id, then you can get it back with just DocModel.get_by_id(id) You should be able to go straight to the doc without the parent account id /doc/12345 I'm not sure you can guarantee id uniqueness across your whole data store, but it should be unique fo