I suspect the error is here:

    image=db(db.image.id==request.args[0]).select()[0]

Are you passing request.args[0]? Are you sure one record was selected?
Try replace the above line with

    try: image=db(db.image.id==request.args[0]).select()[0]
    except: redirect(URL(r=request,f='index'))

On Nov 3, 9:06 am, cevdetural <[EMAIL PROTECTED]> wrote:
> • I am trying to see the result of the sample “images” in
> “web2py_manual_cut.pdf” .
>   After copy and paste db.py from the  “web2py_manual_cut.pdf” ,
> db.images and
>   db.comments are perfectly existing and working under database
> adminstration.
> • But after writing(copy and paste) default.py an error is occuring
> (error-ticket below).
> •What is the problem and how to solve it ?
> •I need some help . Thanks in advance..
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Ticket 127.0.0.1.2008-11-03.15-27-19.871200cf-
> e65c-4087-8e9e-956f2aa28f99 Error traceback
>         Traceback (most recent call last):
>   File "gluon\restricted.pyc", line 62, in restricted
>   File "D:\w2py_3\web2py_win\web2py\applications\images/controllers/
> default.py", line 19, in <module>
>   File "gluon\globals.pyc", line 55, in <lambda>
>
> #################### ERROR IS HERE ###############################
>
>   File "D:\w2py_3\web2py_win\web2py\applications\images/controllers/
> default.py", line 6, in show
> IndexError: list index out of range
> In file: D:\w2py_3\web2py_win\web2py\applications\images/controllers/
> default.py
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> def index():
>     images=db().select(db.image.ALL,orderby=db.image.title)
>     return dict(images=images)
>
> def show():
>     image=db(db.image.id==request.args[0]).select()[0]
>     form=SQLFORM(db.comment,fields=['author','email','body'])    ###
> line 6, in show
>     form.vars.image_id=image.id
>     if form.accepts(request.vars,session):
>        response.flash='your comment is posted'
>     comments=db(db.comment.image_id==image.id).select()
>     return dict(image=image,comments=comments,form=form)
>
> def download():
>    import os
>    path=os.path.join(request.folder,'uploads',request.args[0])
>    return response.stream(path)
>
> response._vars=response._caller(show)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to