When you visit the show action

http:/..../show/[record_id]

do you have a valid [record_id]?

Massimo

On Aug 9, 7:40 am, jayvandal <[email protected]> wrote:
> Hello again,
> I went to ubuntu 9.04 on my computer and created images down to and
> including the show and download in the default.py. I click on SHOW and
> I get the error -- list index out of range-- I click on download and
> get the same error.
> This line seems to be the problem
> =====================
>  image=db(db.image.id==request.args[0]).select()[0]
> ====================================
> Any help
> Thanks
> JIm
> I'll go on to wiki  on Ubuntu.
>
> Error ticket for "images"
> Ticket
> 127.0.0.1.2009-08-09.06-22-39.2a8e486a-0d33-4baa-8f3c-789c6808b2e4
>
> Traceback (most recent call last):
>   File "/home/jim/web2py/gluon/restricted.py", line 178, in restricted
>     exec ccode in environment
>   File "/home/jim/web2py/applications/images/controllers/default.py",
> line 19, in <module>
>   File "/home/jim/web2py/gluon/globals.py", line 101, in <lambda>
>     self._caller = lambda f: f()
>   File "/home/jim/web2py/applications/images/controllers/default.py",
> line 6, in show
>     image=db(db.image.id==request.args[0]).select()[0]
> IndexError: list index out of range
> Error traceback
> 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'])
>   form.vars.image_id=image.id
>   if form.accepts(request.vars,session):
>     response.flash='your comment is oposted'
>   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)
>
> Traceback (most recent call last):
>   File "/home/jim/web2py/gluon/restricted.py", line 178, in restricted
>     exec ccode in environment
>   File "/home/jim/web2py/applications/images/controllers/default.py",
> line 19, in <module>
>   File "/home/jim/web2py/gluon/globals.py", line 101, in <lambda>
>     self._caller = lambda f: f()
>   File "/home/jim/web2py/applications/images/controllers/default.py",
> line 6, in show
>     image=db(db.image.id==request.args[0]).select()[0]
> IndexError: list index out of range
>
> In file: /home/jim/web2py/applications/images/controllers/default.py
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
>
> 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'])
>   form.vars.image_id=image.id
>   if form.accepts(request.vars,session):
>     response.flash='your comment is oposted'
>   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)
>
> Powered by web2py (TM) created by Massimo Di Pierro © 2007, 2008,
> 2009
> -------------------------------------------------------------------------------------
>
> On Aug 8, 1:32 am, Yarko Tymciurak <[email protected]> wrote:
>
> > Massimo -  I this is about image excercise from the book; Jim deleted his
> > database, then things didn't work (I directed him to clear his databases
> > directory - let's see how that works out)
>
> > - Yarko
>
> > On Sat, Aug 8, 2009 at 2:17 AM, mdipierro <[email protected]> wrote:
>
> > > which problems? can you say more?
>
> > > On Aug 7, 10:33 pm, jayvandal <[email protected]> wrote:
> > > > Could I have problems with Vista and web2py? I am having trouble in
> > > > WIKI in web2py manual  with the index as I had in IMAGES??
> > > > JIM
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to