Hello, I have this app in gae where I want to fetch the latest 20
profiles. The model is:

***********************************************
db.define_table('userprofile',
    Field('owner', 'reference auth_user', readable=False,
writable=False, default=auth.user_id),
    Field('created', 'datetime', readable=False, writable=False,
default=request.now))
***********************************************

so I get those latest 20 by ordering via the created field:

***********************************************
profiles =
db(db.userprofile.created).select(orderby=~db.userprofile.created,
limitby=(0,20))
***********************************************

which is basically, for me, a select all records but limit to the
first 20. Now the problem is that when I loop over the "profiles"
variable nothing happens. When testing on localhost:8080, print
profiles would show me the profiles I need. However, when I try to
loop over them on GAE or in localhost:8080 with:

***********************************************
for profile in profiles:
  print profile
***********************************************

Nothing happens, as if it was skipped. This does not happen on the
default server (localhost:8000). I did it the other way and still the
loop doesn't happen:

***********************************************
profiles = db().select(db.userprofile.ALL,
orderby=~db.userprofile.created, limitby=(0,20))
***********************************************

I printed out and also checked the length and the record is there, but
looping over the Rows object does nothing. Even without the select()
options nothing happens:

***********************************************
for x in db().select(db.userprofile.ALL):
        print x
***********************************************

This seems to be gae specific but I'd like to know the workaround. I
just want to display the latest profiles on the home page. I wanted to
also add random profiles but I think I have yet to make this work
first.

TIA,
arbie

Reply via email to