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_properties

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 <dan.kam...@gmail.com> 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 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