In controller : def index(): session.counter = (session.counter or 0) + 1 return dict(message="Hello from MyApp", counter=session.counter)
View : <html> <head></head> <body> <h1>{{=message}}</h1> <h2>Number of visits: {{=counter}}</h2> </body> </html> >From the book and it should work... On Tue, May 15, 2012 at 2:16 PM, Gerald Klein <jk121...@gmail.com> wrote: > outside of the string passed to the message variable in the call to dict > my code is exactly the same, I didn't have any luck with the version above > this so I coded this instead. As far as the syntax error, I would be happy > to know where it is as I can't see it. And yes the trace is pointing to a > piece of code that doesn't show in my file. > non-keyword arg after keyword arg (default.py, line 14) > and line 14 is the last line of my code that I am showing here. > *return dict(message="hello", session.counter)* > * > * > I haven't worked on this since earlier today, but I wanted to reply. > > thanks > > --jerry > > On Tuesday, May 15, 2012 11:08:43 AM UTC-5, IK wrote: >> >> hm, I checked online book and example you mentioned, contains variable >> name in dict function, while your example above, doesn't. Is this the >> example you are talking about? (http://web2py.com/books/** >> default/chapter/29/3#Let%27s-**count<http://web2py.com/books/default/chapter/29/3#Let%27s-count> >> ). >> >> def index(): >> session.counter = (session.counter or 0) + 1 >> return dict(message="Hello from MyApp", counter=session.counter) >> >> >> >> >> >> >> On 15 May 2012 17:00, Gerald Klein <jk121...@gmail.com> wrote: >> >>> All suggestions that I will check out, but this is >>> actually character for character from the web2py site. I guess that's why I >>> am scratching my head. That and the fact that the debug references text >>> that is not on the page. I am always leery of platforms that do a lot for >>> you, sometimes you give up control of important aspects. It points to a >>> line of code that is in my file and not a dynamically generated platform >>> file. >>> >>> but thanks I will check these suggestions out and see what gives. >>> >>> --jerry >>> >>> >>> On Tuesday, May 15, 2012 7:56:30 AM UTC-5, Gerald Klein wrote: >>>> >>>> I am working through the tutorial on the web2py site, checking web2py >>>> out and I keep getting errors for things I can't see. Like >>>> >>>> type 'exceptions.SyntaxError'> non-keyword arg after keyword arg >>>> (default.py, line 14) >>>> That code does not exist on the page. The prior code is: >>>> *def index():* * session.counter = (session.counter or 0) + 1* * >>>> return dict(message="hello", session.counter)* >>>> >>>> >>>> the last line is line 14? >>>> >>>> Does anyone have an idea of what this is? >>>> >>>> thanks >>>> >>>> --jerry >>>> >>>> >>