Thanks, neither suggestion has helped.
Yarko, I double click on the app to start it. On a Mac an app is just
a directory, and a shell doesn't understand
the specialness of the .app suffix, only the Finder does.
Massimo, the response.flash is always correct, just the label and the
default value of the text field is out of sync.
If I change
session.bene_year = request.post_vars.year
to
session.bene_year = form.post_vars.year
I get a runtime error
AttributeError: 'FORM' object has no attribute 'post_vars'
===
Here's an even simpler version of the bug:
model:
db.define_table('beneficiary',
SQLField('name','string'),
SQLField('year','integer'))
default controller:
def index():
import datetime
# form sets the default year to work on
if not session.bene_year:
session.bene_year = str(datetime.datetime.now().year)
form = FORM('Set Year (current value is '+session.bene_year+') :
',
INPUT(_name='year', _value=session.bene_year,
requires=IS_NOT_EMPTY()),
INPUT(_type='submit'))
# set the default year from the form
if FORM.accepts(form, request.post_vars, session,
formname='form_one'):
session.bene_year = request.post_vars.year
# set the year
response.flash = 'The default year is set to
'+session.bene_year
# fetch the current beneficiaries for the default year
records = SQLTABLE(db
(db.beneficiary.year==session.bene_year).select(db.beneficiary.ALL),
truncate='1024')
return dict(form=form, records=records)