In my database model I have a parent table 'thg_thing' and a child table
'thg_book'
Furthermore I have a function book_form which contains the following code:
form = SQLFORM(db.thg_book, row, deletable=False, upload=URL('default',
'download'), showid=False, buttons=buttons)
if hasattr(request.vars.image, 'filename'):
form.vars.imagefilename = request.vars.image.filename
if form.validate():
if row:
row.update_record(**db.thg_book._filter_fields(form.vars))
if form.vars.image__delete:
file = row.image
os.remove(os.path.join(UPLOADSDIR, 'vertex%s' % vertexid,
file))
row.update_record(imagefilename=None, image=None,
width=None, height=None)
form.vars.thingid = db.thg_thing.insert(name=form.vars.h1selector)
db.thg_book.insert(**db.thg_book._filter_fields(form.vars))
Now when I submit the form, I get the following error:
db.thg_book.insert(**db.thg_book._filter_fields(form.vars))
raise RuntimeError("Unable to handle upload")
RuntimeError: Unable to handle upload
I don't understand why I het this error, is it because I use form.validate()
instead of if form.process().accepted:
Kind regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/255dd20c-cc86-49ff-8828-39f2c47b7cecn%40googlegroups.com.