[web2py] Re: passing varibales

2011-01-22 Thread b0j3
On 22 jan., 11:47, Rick sababa.sab...@gmail.com wrote: Hi, My problem is that I want to make a {{=A...}} tag that also changes the value of the variable session.variable, and I don't know how to do this. I tried with: {{=A(([ ]), session.variable=-1,  _href=URL('function'))}} ...but it

Re: [web2py] Re: passing varibales

2011-01-22 Thread Jason Brower
Yup... I think you should do that in the controller before you pass it. It's a two second job so not hard to do. That and session.variable=-1 is well... -1 it should be variable-=1. On the other had, you may be going for -1 :P and you may be using a special loop or something that needs to

[web2py] Re: passing varibales

2011-01-22 Thread Rick
Thanks for the replies. I wrote a special def for the operation: def minorvar(): variable-=1 redirect(URL('index')) ...but I get an error that says that: local variable 'variable' referenced before assignment ...even though I've defined the variable as global at the beginning of

Re: [web2py] Re: passing varibales

2011-01-22 Thread Jason Brower
I would recommend that you use session.variable if that's what you want to do. Could we see the controller for the page before? I wonder if there is a way we could put the action in there to make your code a bit cleaner. BR, JB On 01/23/2011 01:04 AM, Rick wrote: Thanks for the replies. I

[web2py] Re: passing varibales

2011-01-22 Thread Rick
Here is some code from the controller file: variable = 0 def index() some operations with the variable... def minorvar(): variable-=1 redirect(URL('index')) I also tried with this code, but the variable isn't changed after

Re: [web2py] Re: passing varibales

2011-01-22 Thread Jason Brower
Ok here is what I see as the problem. What you are doing is setting variable as 0 every time you start a webpage. Every time you start a webpage this entire file is look over as if it was never seen before. Doing so is a great thing but you have to take the approch differently knowing this.

[web2py] Re: passing varibales

2011-01-22 Thread Rick
Thanks a lot! It works now. On Jan 23, 4:37 am, Jason Brower encomp...@gmail.com wrote: Ok here is what I see as the problem. What you are doing is setting variable as 0 every time you start a webpage. Every time you start a webpage this entire file is look over as if it was never seen