Hi Massimo: That's right, the validators were causing the problem. (I kept experimenting after sending the email, but didn't update to the list because my original email didn't appear until this morning.) The validator, created via the interactive model tool, was passing all the field names from the table being referenced. When I reduced the field count, everything worked fine.
Thanks for your quick reply and for web2py. I've been able to get my head around it and make progress much faster than with other frameworks / cms's I've tried. Keith On May 10, 12:17 am, mdipierro <[email protected]> wrote: > This has nothing to do with upload (and your table is correct) but > something is wrong with validators. > Are you setting any validators? Can you post the code? > > Massimo > > On May 9, 7:36 pm, Keith <[email protected]> wrote: > > > Greetings: > > > I'm creating my first model. I set up the database and first table > > like this: > > > db=SQLDB('sqlite://db.db') > > > db.define_table('contact', > > SQLField('cont_first_name', 'string', length=15), > > SQLField('cont_last_name', 'string', length=25), > > SQLField('cont_organization', 'string', length=80), > > SQLField('cont_phone', 'string', length=20), > > SQLField('cont_email', 'string', length=80)) > > > I have entered a couple of records via the admin interface and it > > works fine. At the same time, I defined the following table: > > > db.define_table('classroom', > > SQLField('room_name', 'string', length=50, required=True), > > SQLField('room_location', 'string', length=80, required=True), > > SQLField('room_capabilities', 'string', length=80), > > SQLField('room_equipment', 'string', length=80), > > SQLField('room_photo', 'upload'), > > SQLField('id_contact', db.contact)) > > > When I try to insert a new record into this table, I get the following > > ticket: > > > Traceback (most recent call last): > > File "gluon/restricted.py", line 98, in restricted > > File "C:/web2py_win/applications/nydl/controllers/appadmin.py", line > > 272, in <module> > > File "gluon/globals.py", line 75, in <lambda> > > File "C:/web2py_win/applications/nydl/controllers/appadmin.py", line > > 102, in insert > > File "gluon/sqlhtml.py", line 377, in __init__ > > File "gluon/sqlhtml.py", line 135, in widget > > File "gluon/validators.py", line 251, in options > > File "gluon/validators.py", line 238, in build_set > > File "gluon/sql.py", line 1979, in select > > ValueError: too many values to unpack > > > I thought 'upload' might be giving me the problem, so I changed it to > > blob, but that didn't work. Tried adding ID to the contact reference > > (db.contact.id), to no avail. I made sure the contact definition came > > before the call to it in the classroom definition. I bought and read > > the manual, checked and rechecked this, searched the group, but > > haven't been to see what I'm doing wrong. Any suggestions? > > > TIA > > > Keith --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

