Is ThreadCache(db.Model) class the parent of the Image(db.Model) class? If so you must name the parent in the Image.get_by_key_name()
Model.get_by_key_name(key_names, parent=None) http://code.google.com/appengine/docs/datastore/modelclass.html#Model_get_by_key_name 2008/12/26 some_developer <[email protected]>: > > No, this is key name, wich I set before saving object in key_name > property. > > On 26 дек, 18:49, djidjadji <[email protected]> wrote: >> > cache2 = >> > Image.get_by_key_name('bz3edbdc420cf4daa2529d797e7aa273aefa76a10d') >> >> Your key_name looks more like a full key. For that use >> cache2 = Image.get(db.Key('bz3edbdc420cf4daa2529d797e7aa273aefa76a10d')) >> or just >> cache2 = Image.get('bz3edbdc420cf4daa2529d797e7aa273aefa76a10d') >> >> http://code.google.com/appengine/docs/datastore/modelclass.html#Model... >> >> 2008/12/26 some_developer <[email protected]>: >> >> >> >> > Hi. >> > I have two models. Each object of this models has a key name. When I >> > trying to get objects by they key names, with first model all OK, but >> > with second model I get None. Both key names are proper. >> >> > This is the first model: >> >> > class ThreadCache(db.Model): >> > response = PickledProperty(required = True) #my property, >> > nevermind >> > pub_date = db.DateTimeProperty(auto_now_add = True) >> >> > And this model return None by any correct key name: >> >> > class Image(db.Model): >> > content = db.BlobProperty(required = True) >> > type = db.StringProperty(required = True) >> >> > That's how I getting objects: >> >> > cache1 = ThreadCache.get_by_key_name('b-379') #return object >> > cache2 = Image.get_by_key_name >> > ('bz3edbdc420cf4daa2529d797e7aa273aefa76a10d') #return None >> >> > What I must know about key names? And why I have problem only with the >> > second model? > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
