Yes, that thread describes the problem. I had realized it had to do with the URL and found a different workaround. Instead of building a new URL and passing it to crud via next=, I set up an 'onaccept' function which sets up a session.flash and then redirects as desired. This is working! Still, nice that the bug is recognized and will get fixed.
Thanks for your help On Nov 7, 1:44 pm, Richard Vézina <ml.richard.vez...@gmail.com> wrote: > This thread might interest you : > > http://groups.google.com/group/web2py/browse_thread/thread/f35eeb3c78... > > Richard > > On Mon, Nov 7, 2011 at 11:38 AM, Richard Vézina <ml.richard.vez...@gmail.com > > > > > > > > > wrote: > > Did you have a look of what is coming out request.vars.membid and > > request.vars.next... I maybe not what you expect that you get and it may > > cause the problem... > > > If you test your controller manually does it work properly? If so, it must > > be a wrong type coming from your request.vars, you can try to convert to > > the proper type int(request.vars.membid) for example. > > > Richard > > > On Mon, Nov 7, 2011 at 10:44 AM, David Manns <dgma...@gmail.com> wrote: > > >> I don't think its to do with the model (the table in question has no > >> float or decimal in any case). > > >> I think it has to do with the handling of next= in crud. > > >> The controller code (somewhat simplified, but still reproduces the > >> problem) is: > > >> def memberform(): > >> if request.vars.membid: > >> next = URL('memberform', > >> vars=dict(membid=request.vars.membid, > >> next=request.vars.next)) > >> form = crud.update(db.Members, request.vars.membid, > >> next=next) > >> else: > >> form = crud.create(db.Members, next=request.vars.next) > >> return dict(form=form, next=request.vars.next, > >> membid=request.vars.membid) > > >> The first time in, with membid the ID of an existing record, the > >> record is correctly displayed via the crud.update() form. When a > >> field is edited and the form submitted, the failure occurs. > > >> On Oct 28, 7:59 am, Richard Vézina <ml.richard.vez...@gmail.com> > >> wrote: > >> > Without model I think it difficult to debug... > > >> > But the problem come from a float type error, so there must be a failing > >> > constrain on one of your field... Look at you member model if there is a > >> > double type field or decimal and make sure you have a validator with > >> > appropriate constraining domain... > > >> > doubleIS_FLOAT_IN_RANGE(-1e100, > >> 1e100)decimal(n,m)IS_DECIMAL_IN_RANGE(-1e100, > >> > 1e100) > >> > Richard > > >> > On Sat, Oct 15, 2011 at 10:15 AM, David Manns <dgma...@gmail.com> > >> wrote: > >> > > This problem appeared when I moved my application from x to 1.99.2. > > >> > > I use crud.update to display and modify a member directory record. > >> > > Selecting and displaying the record works, but when submitting an > >> updated > >> > > record I get a failure: > > >> > > TRACEBACK > > >> > > 1. > >> > > 2. > >> > > 3. > >> > > 4. > >> > > 5. > >> > > 6. > >> > > 7. > >> > > 8. > >> > > 9. > >> > > 10. > >> > > 11. > >> > > 12. > > >> > > Traceback (most recent call last): > >> > > File "C:\Documents and Settings\David Manns\My > >> Documents\ocsnedb\gluon\restricted.py", line 194, in restricted > >> > > raise > >> > > File "C:/Documents and Settings/David Manns/My Documents/ocsnedb > >> saved/applications/init/controllers/default.py" < > >>http://127.0.0.1:8000/admin/default/edit/init/controllers/default.py>, > >> line 889, in <module> > >> > > File "C:\Documents and Settings\David Manns\My > >> Documents\ocsnedb\gluon\globals.py", line 149, in <lambda> > >> > > File "C:/Documents and Settings/David Manns/My Documents/ocsnedb > >> saved/applications/init/controllers/default.py" < > >>http://127.0.0.1:8000/admin/default/edit/init/controllers/default.py>, > >> line 273, in memberform > >> > > deletable = False, next=next, onvalidation=setmodified) > >> > > File "C:\Documents and Settings\David Manns\My > >> Documents\ocsnedb\gluon\tools.py", line 2994, in update > >> > > formname=DEFAULT, > >> > > File "C:\Documents and Settings\David Manns\My > >> Documents\ocsnedb\gluon\tools.py", line 79, in replace_id > >> > > TypeError: float argument required > > >> > > The controller code looks like: > > >> > > def memberform(): > >> > > chkurlreader() > >> > > if request <http://127.0.0.1:8000/examples/global/vars/request > >> >.vars.membid: > >> > > member=db.Members[request < > >>http://127.0.0.1:8000/examples/global/vars/request>.vars.membid] > >> > > db.Members.Email.comment = A < > >>http://127.0.0.1:8000/examples/global/vars/A>('Add/Edit/Delete Email > >> Address(es)', > >> > > _href=URL > >> > > <http://127.0.0.1:8000/examples/global/vars/URL>('memberemail', > >> vars=dict(membid=request < > >>http://127.0.0.1:8000/examples/global/vars/request>.vars.membid, > >> next=request <http://127.0.0.1:8000/examples/global/vars/request > >> >.vars.next))) > >> > > db.Members.Affiliation.comment = A < > >>http://127.0.0.1:8000/examples/global/vars/A>('Add/Edit/Delete > >> Affiliation(s)', > >> > > _href=URL > >> > > <http://127.0.0.1:8000/examples/global/vars/URL>('memberaffiliation', > >> vars=dict(membid=request < > >>http://127.0.0.1:8000/examples/global/vars/request>.vars.membid, > >> next=request <http://127.0.0.1:8000/examples/global/vars/request > >> >.vars.next))) > >> > > if member.Status in ('Full', 'Student'): > >> > > db.Members.Paiddate.comment = A < > >>http://127.0.0.1:8000/examples/global/vars/A>('Process dues payment', > >> > > _href=URL < > >>http://127.0.0.1:8000/examples/global/vars/URL>('memberdues', > >> vars=dict(membid=request < > >>http://127.0.0.1:8000/examples/global/vars/request>.vars.membid, > >> next=request <http://127.0.0.1:8000/examples/global/vars/request > >> >.vars.next))) > >> > > else: > >> > > db.Members.Paiddate.comment = 'Only for Full & Student > >> Members' > >> > > next = URL > >> > > <http://127.0.0.1:8000/examples/global/vars/URL>('memberform', > >> vars=dict(membid=request < > >>http://127.0.0.1:8000/examples/global/vars/request>.vars.membid, > >> next=request <http://127.0.0.1:8000/examples/global/vars/request > >> >.vars.next)) > >> > > form = crud.update(db.Members, request < > >>http://127.0.0.1:8000/examples/global/vars/request>.vars.membid, > >> > > deletable = False, next=next, > >> onvalidation=setmodified) > >> > > form[0][-1][1].append(INPUT < > >>http://127.0.0.1:8000/examples/global/vars/INPUT > >> >(_type="button",_value="Cancel", > >> > > _onclick="window.location='%s';"%request < > >>http://127.0.0.1:8000/examples/global/vars/request>.vars.next)) > >> > > else: > >> > > db.Members.Email.comment = 'Add email address(es) after creating > >> basic record' > >> > > db.Members.Affiliation.comment = 'Add affiliation(s) after > >> creating basic record' > >> > > db.Members.Paiddate.comment = 'Usually set by processing dues > >> payment' > >> > > form = crud.create(db.Members, next=request < > >>http://127.0.0.1:8000/examples/global/vars/request>.vars.next, > >> onaccept=newmember) > >> > > form[0][-1][1].append(INPUT < > >>http://127.0.0.1:8000/examples/global/vars/INPUT > >> >(_type="button",_value="Cancel", > >> > > _onclick="window.location='%s';"%request < > >>http://127.0.0.1:8000/examples/global/vars/request>.vars.next)) > >> > > return dict(form=form, next=request < > >>http://127.0.0.1:8000/examples/global/vars/request>.vars.next, > >> membid=request <http://127.0.0.1:8000/examples/global/vars/request > >> >.vars.membid)