which one is line 16 in gallery.py ?

this

> def download():
>  import os
>     path = os.path.join(request.folder,'uploads',request.args[0])
>  return response.stream(path)

should be

def download(): return response.download(request,wtb)

Massimo

On Feb 20, 11:03 pm, weheh <[email protected]> wrote:
> I'm trying to develop my version of the image upload and commenting
> application that's in the documentation. But when I submit a comment
> on a photo, I get the following error ticket. Is it dying in the
> form.accepts code?
>
> Traceback (most recent call last):  File "/Users/mdipierro/web2py/
> gluon/restricted.py", line 98, in restricted  File "C:/web2py/
> applications/myapp/controllers/gallery.py", line 40, in <module>  File
> "/Users/mdipierro/web2py/gluon/globals.py", line 74, in <lambda>  File
> "C:/web2py/applications/myapp/controllers/gallery.py", line 16, in
> show  File "/Users/mdipierro/web2py/gluon/sqlhtml.py", line 534, in
> accepts  File "/Users/mdipierro/web2py/gluon/sql.py", line 1263, in
> insert  File "/Users/mdipierro/web2py/gluon/sql.py", line 1258, in
> _insertTypeError: sequence item 0: expected string, SQLField found
>
> In file: C:\web2py\applications\myapp/controllers/gallery.pydef photos
> (): return dict()
>
> def show():
>  nav = wtb( (wtb.gallery.title==request.args[0]) & \
>                 (wtb.gallery.id==wtb.galleryImages.gallery_id) & \
>                 (wtb.galleryImages.image_id==wtb.image.id) ).select()
>  if len(request.args) > 1:
>      photo = wtb( (wtb.gallery.title==request.args[0]) & \
>                     (wtb.gallery.id==wtb.galleryImages.gallery_id) & \
>                     (wtb.galleryImages.image_id==wtb.image.id) & \
>                     (wtb.image.id==request.args[1]) ).select()[0]
>  else:
>      photo = nav[0]
>  form = SQLFORM(wtb.comment, fields=['name','email','body'], labels=
> {'body':'Comment:'})
>  form.vars.image_id = wtb.image.id
>     if form.accepts(request.vars,session):
>      response.flash='Thank you for your comment'
>  elif form.errors:
>      response.flash='Form has errors'
>  else:
>      response.flash='Please fill in the form'
>  comments = wtb((wtb.comment.image_id==photo.image.id)).select
> (orderby=wtb.comment.date)
>  return dict(photo=photo,nav=nav,comments=comments,form=form)
>
> def download():
>  import os
>     path = os.path.join(request.folder,'uploads',request.args[0])
>  return response.stream(path)
>
> def upload():
>  return dict()
>
> # # uncomment the following if you have defined "auth" and "crud" in
> models
> # def user(): return dict(form=auth())
> # def data(): return dict(form=crud())
> # def download(): return response.download(request,db)
> # # tip: use @auth.requires_login, requires_membership,
> requires_permission
>
> 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 [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