Thanks.  I think that turned out to be more of a Python question than
a GAE question.  I'm using getattr(obj, 'foo_%d' % x), and it seems to
be working fine.

On Dec 28, 1:36 pm, Alexander Kojevnikov <[email protected]>
wrote:
> You should not rely on the implementation details, they can change and
> break your code.
>
> The Model class has a properties() 
> method:http://code.google.com/appengine/docs/datastore/modelclass.html#Model...
>
> To access the values of the properties you can use this code:
>
> for prop in obj.properties():
>     value = getattr(entity, prop)
>
> Cheers,
> Alex
> --www.muspy.com
>
> On Dec 29, 8:21 am, boson <[email protected]> wrote:
>
> > Say I have:
>
> > class MyClass(db.Model):
> >   foo1 = db.IntegerProperty()
> >   foo2 = db.IntegerProperty()
> >   foo3 = db.IntegerProperty()
>
> > obj = MyClass(foo1=100, foo2=200, foo3=300)
>
> > I want to loop over foo values.  I found that I can do:
>
> > for x in [1, 2, 3]:
> >   print obj.__dict__['_foo%d' % x]
>
> > Is this bad / subject to break?
> > Is there a better way to do this?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to