here is what i just tried:

db.define_table('menu_item',
  Field('created_on','datetime', default=request.now,writable=False),
  Field('name', length=500, notnull=True, unique=True,
        requires=IS_NOT_IN_DB(db, 'menu_item.name')),
  migrate=migrate)

then in controller:

def index():
    
data=db(db.menu_item.created_on).select(orderby=~db.menu_item.created_on, 
limitby=(0,20))

    data2=db().select(db.menu_item.ALL,orderby=~db.menu_item.created_on, 
limitby=(0,20))

    return dict(data=data, data2=data2)


then in view:

{{=BEAUTIFY(response._vars)}}

<h1>data</h1>
{{for d in data:}}
  {{=d.name}}<br />
{{pass}}

<hr />
<h1>data2</h1>
{{for d in data2:}}
  {{=d.name}}<br />
{{pass}}

and got exactly what i was expecting.  some things i noticed:
 - i don't think db(db.menu_item.created_on) is a valid query.  it needs to 
be compared to something right?  (i know it works, but it seems wrong to me)
 - print doesn't work on GAE (there is no console to output to in that 
environment) so i assumed you were either using logging or outputting in a 
view

can you tell me more, or send me a minimal application that produces the 
problem and i'll try it out too?  it sounds like something is up, so let's 
get to the bottom of it and get it fixed!

christian

Reply via email to