[web2py] Re: after_update callback question

2014-04-04 Thread mcamel
You are right. Both work. I don't know what happenend, but now it works to me. So it was my fault messing the code. I'm very sorry. El jueves, 3 de abril de 2014 21:55:59 UTC+2, Anthony escribió: > > Hmm, I have tried both methods (assigning a global variable and adding an > attribute to "cur

[web2py] Re: after_update callback question

2014-04-03 Thread Anthony
Hmm, I have tried both methods (assigning a global variable and adding an attribute to "current"), and in both cases it works fine (i.e., with the callback defined and set in a model file and with the update happening in a controller function). Perhaps you could attach a minimal app that reprod

[web2py] Re: after_update callback question

2014-04-03 Thread mcamel
Sorry, i wanted to say 'model' not 'module'. I've tried to pass data from a callback in a model to "its" function in a controller with 'current', but was not able: def my_before_callback(): from gluon import current current._mydata = 'hello' In a controller: def my_function(): db..

[web2py] Re: after_update callback question

2014-04-03 Thread Anthony
On Thursday, April 3, 2014 10:58:32 AM UTC-4, mcamel wrote: > > > Be careful about storing something in request.vars, as some other code may depend on request.vars and end up failing due to it being changed. >>> >>> Any alternative you can suggest?. Session object seems error prone for

[web2py] Re: after_update callback question

2014-04-03 Thread mcamel
> Be careful about storing something in request.vars, as some other code may >>> depend on request.vars and end up failing due to it being changed. >>> >> >> Any alternative you can suggest?. Session object seems error prone for >> this because of concurrency... >> > > You could just declare a

[web2py] Re: after_update callback question

2014-04-02 Thread Anthony
> > Be careful about storing something in request.vars, as some other code may >> depend on request.vars and end up failing due to it being changed. >> > > Any alternative you can suggest?. Session object seems error prone for > this because of concurrency... > You could just declare a global v

[web2py] Re: after_update callback question

2014-04-02 Thread mcamel
Hello, I've tried your suggestion and worked!. At 'before_update' stored old >> values in request.vars using Set object, then at 'after_update' access >> these values and compare to the new ones at f. >> > > Be careful about storing something in request.vars, as some other code may > depend on

[web2py] Re: after_update callback question

2014-04-02 Thread Anthony
> > I've tried your suggestion and worked!. At 'before_update' stored old > values in request.vars using Set object, then at 'after_update' access > these values and compare to the new ones at f. > Be careful about storing something in request.vars, as some other code may depend on request.var

[web2py] Re: after_update callback question

2014-04-02 Thread mcamel
Hello, I've tried your suggestion and worked!. At 'before_update' stored old values in request.vars using Set object, then at 'after_update' access these values and compare to the new ones at f. Note: if you use 'detect_record_change=True' it seems 'before_update' is called twice, though it do

[web2py] Re: after_update callback question

2014-04-01 Thread Anthony
_after_update of course runs *after* the records have been updated in the database, so if you use the Set to check those records in the _after_update callback, they will therefore now have the new values. How could it be any other way? Accessing the Set in the _after_update callback can still be