Thanks for the help.

If as you suggest i pop the element i want to delete, do i then need
to:

person.put()

In order to write the changes back to the datastore?
Sorry if this question is really obvious, but i'm not finding the gae
documentation the most useful.




On Mar 16, 4:40 pm, "M. Page-Lieberman" <mateus.just...@gmail.com>
wrote:
> Sage. Python makes your life a lot easier.
>
> On Mar 16, 2009, at 11:18, Tim Hoffman <zutes...@gmail.com> wrote:
>
>
>
> > Nah
>
> > try:
>
> >    index = keylist.index(keyIWantToFind)
>
> >    keylist.pop(index)
> >    urlist.pop(index)
> >    nameslist.pop(index)
> > except ValueError:
> >    pass
>
> > or
>
> > index = keylist.find( keyIWantToFind)
> > if index > -1:
> >    keylist.pop(index)
> >    urlist.pop(index)
> >    nameslist.pop(index)
>
> > Remember a ListProperty is a list
>
> > See ya
>
> > T
> > T
>
> > Remember ListProperty is a list.
>
> > On Mar 16, 10:29 pm,sagey<sage...@gmail.com> wrote:
> >> Hello, i'd really appreciate some help.
>
> >> I have a model with 3 stringlistproperty properties.
>
> >> keylist
> >> urllist
> >> namelist
>
> >> keylist[0] relates to urllist[0] and namelist[0]
>
> >> i want to be able to search through the keylist property for a key,
> >> then delete each record in the 3 stringlistproperties that relate to
> >> it.
>
> >> I'm presuming the best way to do this is to iterate through the
> >> keylist incrementing a loopcount whilst doing so, and then deleting
> >> the elements of each stringlistproperty using the loopcount??
>
> >> hewres some pseudo code:
>
> >> keyIWantToFind = 'blah
> >> person = db.GqlQuery("SELECT * FROM Person WHERE You = :
> >> 1",users.get_current_user())
> >>                         if person:
> >>                                 loopCount = 0
> >>                                 for thekey in person.keyList:
> >>                                        if keyIWantToFind == thekey:
> >>                                                     #do something to
> >> delete the elements from keylist,namelist and urllist
> >>                                                     # access the
> >> elements to be deleted by keylist[loopcount]  ???
> >>                                        loopCount = loopCount + 1
>
> >> I have 2 questions:
>
> >> 1) What syntax would i use to delete an element from a
> >> stringlistproperty, the gae documentation doesn't mention.
>
> >> 2) Is this the best way to do what i want to do?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to