On Feb 22, 12:51 pm, MajorProgamming <[email protected]> wrote: > I currently have a need to take a result from a query (which is a > list) and remove one entity from it. For some reason though when I > perform the remove, I get an error which says that the entity does not > exist on the list. How can I do this correctly? > > Code: > #excerpt: > #wx and wx2 are db.Query objects with filters... > #I want to remove wx2 from wx > direct=wx2.get() > wx=wx.fetch(limit=50) > wx.remove(direct) > #this code returns an error. I know for a fact (through debugging) > that wx2 entity exists in the wx result. > It's because when you use two different queries to fetch the entity, it gets represented by two distinct object instances. You can try this code:
direct=wx2.get() wx=wx.fetch(limit=50) wx = [entity for entity in wx if entity.key() != direct.key()] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
