I understand what you're saying, but that's all I want to do. I don't want to remove it from the datastore, just from the list, so I can perform some temporary operations on somelist -anotherObject
This makes sense to me now...time to revise a bunch of code. Thanks for the help. On Oct 20, 3:36 pm, djidjadji <[EMAIL PROTECTED]> wrote: > If you want to remove one item from the fetched list then > somelist = theObject.subCategories.fetch(1000) > somelist.remove(anotherObject) > will not work because the 'anotherObject' is another python > representation of the object in the datastore, fetch creates NEW > instances for the objects it retrieves. Thus the remove will not work. > somelist = [theObject.subCategories] > will result in a list which has as its first element a Query object. > somelist = theObject.subCategories.fetch(1000) > already returns a list with object instance. > > 2008/10/20 Alex Vartan <[EMAIL PROTECTED]>: > > > > > get will only return a single object as far as I know. I want to fetch > > all of them. So must I use > > somelist = theObject.subCategories.fetch() > > or will somelist = [theObject.subCategories] work as well, explicitly > > assigning somelist as a list. > > > On Oct 20, 9:33 am, djidjadji <[EMAIL PROTECTED]> wrote: > >> This should work, use get() from the Query object > > >> somelist = theObject.subCategories.get() > >> somelist.remove(anotherObject) > > >> 2008/10/20 Alex Vartan <[EMAIL PROTECTED]>: > > >> > Hi, > > >> > Simple question, but want to make sure I get this right. The docs say: > > >> > "collection_name is the name of the property to give to the referenced > >> > model class whose value is a Query for all entities that reference the > >> > entity. If no collection_name is set, then modelname_set (with the > >> > name of the model in lowercase letters and "_set" added) is used." > > >> > I've got code that reads like this in one of my classes: > > >> > parentCategory = > >> > db.SelfReferenceProperty(collection_name='subCategories') > > >> > Then I need to make a copy of the resulting list, but remove an item > >> > for temporary processing: > > >> > somelist = theObject.subCategories > >> > somelist.remove(anotherObject) > > >> > WIll this work, without having to call a fetch? Since the docs make it > >> > seem like "theObject.subCategories" is actually an object of type > >> > Query. > >> > Thanks, > >> > Alex --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
