Hi Samus, On Fri, Jul 3, 2009 at 5:29 AM, Samus_<[email protected]> wrote: > > actually, the first thing that came to mind for this was to use it as > part of a url to access specific entities since the reference says > it's url-safe: > http://code.google.com/appengine/docs/python/datastore/keyclass.html#Key > and also the same idea is shown on this example: > http://code.google.com/appengine/docs/python/datastore/creatinggettinganddeletingdata.html#Getting_an_Entity_Using_a_Key > but of course if the encoding method is not guaranteed to remain the > same then this is a bad idea (cool URIs don't change right?) good to > know thanks.
Using keys in URLs is more or less an officially 'blessed' approach. For that reason, I'd revise my earlier statement and say that while it's not totally impossible for the key encoding format to change in future, it's extremely unlikely. That said, you can provide much more user-friendly URLs if you use just the fields you need from the key - www.mysite.com/123 is much more user friendly than www.mysite.com/somelongbase64string. -Nick Johnson > > On Jun 17, 7:43 am, "Nick Johnson (Google)" <[email protected]> > wrote: >> I would not rely on the encoding str(key) remaining the same, no. The only >> guarantee is that it will be interconvertible - eg, db.Key(str(key)) == key. >> I can't think of a practical reason why you should be relying on this in the >> first place, though. >> >> -Nick Johnson >> >> >> >> On Wed, Jun 17, 2009 at 3:43 AM, gae123 <[email protected]> wrote: >> >> > Nick, >> >> > can we consider what you write below to be part of the API or an >> > internal implementation detail we whould not be relying on? >> >> > Thanks >> >> > > In the case of 'stringified' keys, what you are seeing is the base64 >> > > encoding of the protocol buffer containing the key. You can verify this >> > by >> > > going to shell.appspot.com and entering: >> >> > > --- >> > > from google.appengine.ext import db >> > > db.Key(mystr) >> > > --- >> >> -- >> Nick Johnson, App Engine Developer Programs Engineer >> Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: >> 368047 > > > -- Nick Johnson, App Engine Developer Programs Engineer Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
