This is intended. classone is importend once and it imports classtwo. This 
happens only once before http requests arrive. Python caches modules.

track changes only affect import done explicitly at runtime (when http 
requests are processed).

Changing this would require that web2py keep track of all dependencies (who 
import who). This would slow down everything.

Massimo

On Monday, 25 March 2013 09:55:19 UTC-5, demetrio wrote:
>
> Hi everyone, 
>
> I have notice an strange behaviour of the track_changes feature (working 
> on web2py 2.3.2 and python 2.7.3). 
>
> Imagine the following structure: 
>
> modules/ 
> ├── classone.py 
> ├── __init__.py 
> └── mymodule 
> ├── classtwo.py 
> └── __init__.py 
>
> (assuming that there is a models/0.py file with the track_changes(True) 
> statement) 
>
> In the file classone.py I have the following: 
> #============================== 
> #!/usr/bin/env python 
> # coding: utf8 
> from gluon import * 
> *from mymodule.classtwo import ClassTwo* 
>
> class ClassOne(object): 
> def say_something(self): 
> classtwo = ClassTwo() 
> return classtwo.say_something() 
> #============================== 
>
> And in classtwo.py this: 
> #============================== 
> #!/usr/bin/env python 
> # coding: utf8 
> from gluon import * 
>
> class ClassTwo(object): 
> def say_something(self): 
> return "Hi!" 
> #============================== 
>
> In this case, the changes inside ClassTwo are not tracked, but if I 
> change class one to: 
>
> #============================== 
> #!/usr/bin/env python 
> # coding: utf8 
> from gluon import * 
>
> class ClassOne(object): 
> def say_something(self): 
> *from mymodule.classtwo import ClassTwo* 
> classtwo = ClassTwo() 
> return classtwo.say_something() 
> #============================== 
>
> Now it works correctly and all the changes are tracked, notice that now 
> the import statement is inside of a method. 
>
> In the first case, the custom_importer() function is only called at the 
> first execution to import ClassTwo, but in the second case, 
> custom_importer its called in all executions. 
>
> I have made an example application with this issue attached to this mail. 
>
> Is this intended or it is a bug? 
>
> greetings, Daniel. 
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to