Hi,

Ok, thanks for the responses.


On Nov 25, 5:30 pm, mdipierro <[EMAIL PROTECTED]> wrote:
> You should look into the T2 source code. The class T2 is defined in a
> module. When the module is imported and instantiated you pass request,
> response, session, cache, T and db to it and store references to them
> as member variables.

Thanks, that's a good option.


> Another way would be to execute modules, instead of importing them. I
> think importing is cleaner.

Yes, I didn't think of that!  I agree that it's less clean though
(potentially more confusing). I'll keep it as a backup option.

Another option I found is to use web2py's exec_environment command. If
you hard-code the path to the model then it reduces your module's
reusability, but if you pass the model path string to the module
class's constructor then it seems to give the same result as
separately passing the db/request/response/session. It might be a bit
slower though.


--Jonathan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to