Hi Nick, thanks for your reply! yes indeed a numeric id would be more readable so, just to be clear and for future reference, your suggestion is to use entity.key().id() to construct the url and Model.get_by_id() to retireve the entity right?
On Jul 3, 6:25 am, "Nick Johnson (Google)" <nick.john...@google.com> wrote: > Hi Samus, > > On Fri, Jul 3, 2009 at 5:29 AM, Samus_<mail2sa...@gmail.com> 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/creatinggettin... > > 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. > > Usingkeysin 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/123is much > more user friendly thanwww.mysite.com/somelongbase64string. > > -Nick Johnson > > > > > > > On Jun 17, 7:43 am, "Nick Johnson (Google)" <nick.john...@google.com> > > wrote: > >> I would not rely on the encodingstr(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 <pa...@gae123.com> 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 google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---