wow that page is old (and contains some errors). It is much easier
than that now.
I edited the page

Massimo

On Nov 24, 7:03 am, David <[email protected]> wrote:
> I am trying to follow the example here:
>
> http://www.web2py.com/AlterEgo/default/show/138
>
> But I keep getting this error:
>
> The problem is that I don't understand why there is an error on line
> 20 and there is no line 20 in my controller.  I don't understand how
> that is getting appended.  I thought perhaps it was something I did in
> my app but I created a test app and I still get the error using the
> code from the link above as a reference.
>
> ======================
> Error traceback
>
> Traceback (most recent call last):
>   File "/home/www-data/web2py/gluon/restricted.py", line 182, in
> restricted
>     ccode = compile(code.replace('\r\n', '\n'), layer, 'exec')
>   File "/home/www-data/web2py/applications/test/controllers/
> default.py", line 20
>     response._vars=response._caller(index)
>            ^
> SyntaxError: invalid syntax
>
> In file: /home/www-data/web2py/applications/test/controllers/
> default.py
> Traceback (most recent call last):
>   File "/home/www-data/web2py/gluon/restricted.py", line 182, in
> restricted
>     ccode = compile(code.replace('\r\n', '\n'), layer, 'exec')
>   File "/home/www-data/web2py/applications/test/controllers/
> default.py", line 20
>     response._vars=response._caller(index)
>            ^
> SyntaxError: invalid syntax
>
> =====
> def index():
>     form=SQLFORM(db.image)
>     if form.accepts(request.vars): response.flash='record inserted'
>     images=db().select(db.image.ALL,orderby=db.image.title)
>     return dict(form=form,images=images)
>
> def edit():
>     image=db(db.image.id==request.args[0]).select()[0]
>     form=SQLFORM(db.image,image,upload=URL(r=request,f='download'))
>     if form.accepts(request.vars): redirect(URL(r=request,f='index'))
>     return dict(form=form)
>
> def download():
>     import os
>     from gluon.contenttype import contenttype
>     image=db(db.image.filename==request.args[0]).select()[0]
>     response.headers['Content-Type']=contenttype(image.filename)
>     return response.stream(os.path.join
> (request.folder,'uploads',image.filename)
>
> response._vars=response._caller(index)
>
> ==========================
--~--~---------~--~----~------------~-------~--~----~
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