do you have the source distribution? or are you running web2py.app?
On Wed, Mar 18, 2009 at 2:12 AM, Jim C <[email protected]> wrote: > > Hi Massimo, > > I'm using 2.5.1 that came with the Mac OS X distribution: web2py > Version 1.58 (2009-03-10 10:51:30) > > --Jim > > On Mar 17, 11:21 pm, mdipierro <[email protected]> wrote: > > Are you using python 2.6 or 2.5? > > > > Massimo > > > > On Mar 18, 12:43 am, Jim C <[email protected]> wrote: > > > > > I'm just learning web2py and I've got a simple example whose behavior > > > I don't understand. I've got a page with a form on top that sets a > > > session variable holding the default year. > > > On the bottom of the page I've got an SQLTABLE where the records > > > selected should be from the > > > selected year. What I'm observing is that the form on top accepts > > > the year value and the bottom of the page updates but the form on top > > > always seems to be one update behind. > > > > > In the controller: > > > > > def admin_test(): > > > > > # form1 sets the default year to work on > > > if not session.bene_year: > > > session.bene_year = datetime.datetime.now().year > > > > > form1 = 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(form1, 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 > > > dbrecords = db(db.beneficiary.year==session.bene_year).select > > > (db.beneficiary.ALL) > > > records = SQLTABLE(dbrecords, truncate='1024') > > > > > return dict(form1=form1, dbrecords=dbrecords, records=records) > > > > > The sequence I'm observing is: > > > > > 1) Initial page view, year is set to 2009. All OK. > > > 2) Enter 2007 and press 'Submit Query'. Page refreshes, db records > > > from 2007 appear below, and > > > form one reads: "Set Year (current value is 2009) : [ 2009 ]". > > > Not OK. > > > 3) Replace 2009 with 2005 and press 'Submit Query'. Page refreshes, db > > > records from 2005 appear below and the form now reads: "Set Year > > > (current value is 2007): [ 2007 ]". > > > 4) etc. > > > > > Thanks! > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" 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/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

