It's correct in my model? db.define_table('office', Field('name','string',length = 128,requires=ne), Field('description','text'), Field('pos','integer',default=100))
db.define_table('person', Field('office', db.office, requires = IS_IN_DB(db, 'office.id', '% (name)s', multiple=True)), Field('name')) I'm try insert to person: http://127.0.0.1:8000/init/appadmin/insert/db/person and get this error: Version web2py Version 1.88.2 (2010-10-29 23:04:43) Error traceback Traceback (most recent call last): File "E:\web2py-XDCB\gluon\restricted.py", line 188, in restricted exec ccode in environment File "E:/web2py-XDCB/applications/init/controllers/appadmin.py", line 410, in <module> File "E:\web2py-XDCB\gluon\globals.py", line 96, in <lambda> self._caller = lambda f: f() File "E:/web2py-XDCB/applications/init/controllers/appadmin.py", line 125, in insert if form.accepts(request.vars, session): File "E:\web2py-XDCB\gluon\sqlhtml.py", line 1117, in accepts fields[fieldname] = safe_int(value) File "E:\web2py-XDCB\gluon\sqlhtml.py", line 35, in safe_int return int(x) TypeError: int() argument must be a string or a number, not 'list' On Nov 6, 3:37 am, Richard Vézina <ml.richard.vez...@gmail.com> wrote: > I just test it still there... > > Richard > > On Fri, Nov 5, 2010 at 4:18 PM, Richard Vézina > <ml.richard.vez...@gmail.com>wrote: > > > > > > > > > I will during the weekend. > > > Thank you Massimo > > > Richard > > > On Fri, Nov 5, 2010 at 4:09 PM, mdipierro <mdipie...@cs.depaul.edu> wrote: > > >> I believe this problem was fixed in trunk a few days ago. Did you try > >> trunk? > > >> Massimo > > >> On Nov 5, 2:11 pm, Richard Vézina <ml.richard.vez...@gmail.com> wrote: > >> > Oups! > > >> > I start with tablelist I forgot to correct it. > > >> > It solves the problem default multiselect view un broswer... And banko! > >> We > >> > can reproduce the first problem I had. > > >> > If you change > > >> > Field('userselect','list:reference tablelist',notnull=True)) > > >> > For > > >> > Field('userselect','list:reference userlist',notnull=True)) > > >> > Add some record in userlist then back in name table try to omit the date > >> you > >> > will have the problem... The default multiselect view will break in case > >> the > >> > date is omit in the validator is trigged. > > >> > With more then 10 record list:reference split the id into single digit > >> : > > >> > 10 become 1 and 0 > > >> > Look at the attachement. > > >> > Thanks > > >> > Richard > > >> > On Fri, Nov 5, 2010 at 2:40 PM, mdipierro <mdipie...@cs.depaul.edu> > >> wrote: > >> > > I do not understand: > > >> > > db.define_table('userlist', > >> > > Field('fname','string',notnull=True), > >> > > Field('lname','string',notnull=True), > >> > > format='%(fname)s %(lname)s (%(id)s)') > > >> > > db.define_table('name', > >> > > Field('name','string',notnull=True), > >> > > Field('date','date',notnull=True), > >> > > Field('userselect','list:reference tablelist',notnull=True)) > > >> > > there is no table "tablelist". This > > >> > > On Nov 5, 11:24 am, Richard Vézina <ml.richard.vez...@gmail.com> > >> > > wrote: > >> > > > Can't reproduce it in a dedicated app. > > >> > > > But the list:reference doesn't seems to me to work correctly as it > >> was in > >> > > > the 1.83.2 in which it was managing a list reprensentation. Now I > >> can't > >> > > pick > >> > > > my stuff from a list like in the attached file I sent yesterday. > >> There is > >> > > > only a empty field. > > >> > > > If I try to pass a list of element like : |1|2| it store 0. > > >> > > > Pretty strange behavior to me. > > >> > > > Attached app. > > >> > > > Go to default/create/userlist > >> > > > Create some user > >> > > > Then go to default/create/name > >> > > > See that there is no way to pick the user charged in userlist table > >> > > > There is also default/read/name/ID where you can see that there no > >> list > >> > > > stored in case you load |1|2| in create view. > > >> > > > Regards > > >> > > > Richard > > >> > > > On Thu, Nov 4, 2010 at 4:33 PM, mdipierro <mdipie...@cs.depaul.edu> > >> > > wrote: > >> > > > > Can you please post the model, the controller and the steps to > >> > > > > reproduce the problem? > > >> > > > > Massimo > > >> > > > > On Nov 4, 3:29 pm, Richard Vézina <ml.richard.vez...@gmail.com> > >> wrote: > >> > > > > > More input on the problem. > > >> > > > > > It happen when the date validator is activated. The refresh form > >> not > >> > > > > expose > >> > > > > > the normal list field. I reproduce the problem with Chrome and > >> > > Firefox > >> > > > > > systematically when the date is forgot and required by the > >> model. > > >> > > > > > I attach screenshot of the problem : > > >> > > > > > Capture.png = when date validator is activated > > >> > > > > > Capature-1.png = normal list selector field > > >> > > > > > The main problem is that the id is splited. > > >> > > > > > Richard > > >> > > > > > On Thu, Nov 4, 2010 at 1:57 PM, Richard Vézina > >> > > > > > <ml.richard.vez...@gmail.com>wrote: > > >> > > > > > > Ok I know what the problem has cause : > > >> > > > > > > It seems that the new version is splitting id into single > >> number : > > >> > > > > > > 35 = |3|5| > >> > > > > > > 94 = |9|4| > > >> > > > > > > Instead of : > > >> > > > > > > 94 = |94| > > >> > > > > > > Richard > > >> > > > > > > On Thu, Nov 4, 2010 at 12:33 PM, Richard Vézina < > >> > > > > > > ml.richard.vez...@gmail.com> wrote: > > >> > > > > > >> Hello, > > >> > > > > > >> I get this error... I have no clue why I get it. I think it > >> not > >> > > coming > >> > > > > > >> from my app : > > >> > > > > > >> Traceback (most recent call last): > > >> > > > > > >> File "/home/www-data/web2py/gluon/restricted.py", line 188, > >> in > >> > > > > restricted > > >> > > > > > >> exec ccode in environment > > >> > > > > > >> File > >> > > "/home/www-data/web2py/applications/init/views/appadmin.html" < > >> > > > >https://127.0.0.1/admin/default/edit/init/views/appadmin.html>, > >> line > >> > > 192, > >> > > > > in <module> > > >> > > > > > >> {{=form}} > > >> > > > > > >> File "/home/www-data/web2py/gluon/sqlhtml.py", line 1273, > >> in > >> > > > > __init__ > > >> > > > > > >> r = field.represent(r) > > >> > > > > > >> File "/home/www-data/web2py/gluon/sql.py", line 518, in > >> <lambda> > > >> > > > > > >> (ids and ', '.join(f(r,id) for id in ids) or '') > > >> > > > > > >> TypeError: sequence item 0: expected string, int found > > >> > > > > > >> Error snapshot*Detailed traceback description* > > >> > > > > > >> - Exception: <type 'exceptions.TypeError'>(sequence item > >> 0: > >> > > > > expected > >> > > > > > >> string, int found) > >> > > > > > >> - Python 2.6.4: /usr/bin/python > > >> > > > > > >> File /home/www-data/web2py/gluon/restricted.py in restricted > >> at > >> > > line > >> > > > > 188 > >> > > > > > >> [ code | arguments | variables ] File > >> > > > > > >> /home/www-data/web2py/applications/init/views/appadmin.html > >> in > >> > > > > <module> at > >> > > > > > >> line 192[ code | arguments | variables ] File > >> > > > > > >> /home/www-data/web2py/gluon/sqlhtml.py in __init__ at line > >> 1273[ > >> > > code > >> > > > > | > >> > > > > > >> arguments | variables ] File > >> /home/www-data/web2py/gluon/sql.py in > >> > > > > > >> <lambda> at line 518[ code | arguments | variables ] > >> > > > > > >> *Function argument list: (ids=[9, 4], r=<Table {'first_name': > >> > > > > > >> <gluon.sql.Field object at...itials': <gluon.sql.Field object > >> at > >> > > > > > >> 0xbb52a50c>}>, f=<function ff at 0xbb1db02c>)* > > >> > > > > > >> 513. > >> > > > > > >> 514. > > >> > > > > > >> 515. > >> > > > > > >> 516. > > >> > > > > > >> 517. > > >> > > > > > >> 518. > > >> > > > > > >> 519. > > >> > > > > > >> 520. > >> > > > > > >> 521. > > >> > > > > > >> 522. > > >> > > > > > >> elif field._db and > >> field_type.startswith('list:reference') and > >> > > \ > > >> > > > > > >> field_type.find('.') < 0 and \ > > >> > > > > > >> field_type[15:] in field._db.tables: > > >> > > > > > >> referenced = field._db[field_type[15:]] > > >> > > > > > >> field.represent = lambda ids, r=referenced, f=ff: \ > > >> > > > > > >> (ids and ', '.join(f(r,id) for id in ids) or '') > > >> > > > > > >> if hasattr(referenced, '_format') and > >> referenced._format: > > >> > > > > > >> requires = validators.IS_IN_DB(field._db, > >> > > referenced.id, > > >> > > > > referenced._format,multiple=True) > > >> > > > > > >> if field.unique: > > >> > > > > > >> * > >> > > > > > >> * > > >> > > > > > >> *Richard* > > >> > > > > > >> * > >> > > > > > >> * > > >> > > > > > Capture.png > >> > > > > > 10KViewDownload > > >> > > > > > Capture-1.png > >> > > > > > 12KViewDownload > > >> > > > web2py.app.applistissue.w2p > >> > > > 107KViewDownload > > >> > Capture-2.png > >> > 64KViewDownload > > >> > Capture-3.png > >> > 69KViewDownload