Missing spaces...
def index(): if not session.counter: session.counter = 1 else: session.counter += 1 return dict(message="Hello from MyApp",counter=session.counter) def first(): if request.vars.visitor_name: session.visitor_name = request.vars.visitor_name redirect(URL(('second')) return dict() # This is where it says is the error line 22 def second(): return dict() On Dec 3, 1:10 am, Anaconda <kerwinfra...@gmail.com> wrote: > Hi, i am currently working through the web2py book and i am getting a > an error thrown up even though i am following the books instructions, > this is the code below: > > -- coding: utf-8 -- > # > This is a samples controller > - index is the default action of any application > - user is required for authentication and authorization > - download is for downloading files uploaded in the db (does > streaming) > - call exposes all registered services (none by default) > # > def index(): if not session.counter: session.counter = 1 else: > session.counter += 1 return dict(message="Hello from MyApp", > counter=session.counter) > > def first(): if request.vars.visitor_name: session.visitor_name = > request.vars.visitor_name redirect(URL(('second')) > return dict() #This is where it says is the error line 22 > > def second(): return dict() > > This is the error message: > > failed to compile file because: SyntaxError at line 22 at char 9 > invalid syntax (default.py, line 22 > > Any thoughts what i could be doing wrong as this is how it is in the > online book 3rd edition? Thanks in advance.