On Wednesday, March 27, 2013 4:03:08 AM UTC-4, BlueShadow wrote:
> thanks Anthony, I got a couple lines further^^.
> now this line raises an error.:thisImage=db(dbtable.id==form.vars.id).
> select()[0]
> for some reason I'm not able to select this image anymore.
>
> IndexError: list index out of range
>
>
makeThumbnail(dbtable,form.vars.id,(200,200))
When you process a SQLFORM.factory, no database insert is made, so why are
you passing form.vars.id to makeThumbnail()?
id = db.Images.insert(**db.Images._filter_fields(form.vars))
form.vars.client=id
Your image_references table does not have a "client" field, so why do you
assign the id value to form.vars.client? Given your image_reference table
definition, it should be:
form.vars.image_id = id
id = db.image_references.insert(**db.image_references._filter_fields
(form.vars))
thisImage=db(dbtable.id==form.vars.id).select()[0]
The id of the record inserted is stored in the form.vars.image_id, not in
form.vars.id, so it should be:
thisImage=db(dbtable.id==form.vars.image_id).select()[0]
Also, it does not appear that you use the id of the record inserted into
db.image_reference, so no need to assign that to the "id" variable.
Instead, you can leave the id of the db.Images record in that variable and
use that for the above query:
db.image_references.insert(**db.image_references._filter_fields(form
.vars))
thisImage=db(dbtable.id==id).select()[0]
Anthony
--
---
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].
For more options, visit https://groups.google.com/groups/opt_out.