[web2py] Re: Help with function call

2010-12-26 Thread ron_m
You could consider putting common code in files under modules and use a 
local_import to pull it in. During development set the optional reload=True 
parameter or you have to restart the server to make a modification in a 
module file visible.



[web2py] Re: Help with function call

2010-12-26 Thread weheh
Thanks for the response, ron_m. However, the issue is a little more
nuanced than my message might have stated originally. As a general
rule, ajax(...) and web2py_ajax_page(...) look to a controller for a
callback. I was thinking it might be nice for the ajax call to be
serviced from a global space, since the same callback may be used by
multiple controllers. The problem with putting the callback in modules
or models is that *I think* I need a callback stub in each of the
controllers, said stub then calling the function stored under models
or modules. Is this really the case, or is there a better way? Can the
web2py_ajax_page() or ajax() functions access callbacks in a global
space? If yes, what would the syntax be for such a call?


[web2py] Re: Help with function call

2010-12-26 Thread weheh
Of course, the other problem with using modules is that, especially
with components, I really need to get to the global variable space.
Yes, I can always pass global() and db to the module, but within the
module, it makes the code bloat up a bit with constantly having to do
global['session'].xyz and global['request'].args and such, which is an
added pain.


Re: [web2py] Re: Help with function call

2010-12-26 Thread Thadeus Burgess
Make a controller named system or global?

--
Thadeus




On Sun, Dec 26, 2010 at 2:29 PM, weheh richard_gor...@verizon.net wrote:

 Of course, the other problem with using modules is that, especially
 with components, I really need to get to the global variable space.
 Yes, I can always pass global() and db to the module, but within the
 module, it makes the code bloat up a bit with constantly having to do
 global['session'].xyz and global['request'].args and such, which is an
 added pain.



[web2py] Re: Help with function call

2010-12-26 Thread weheh
Yes, that's a possibility, too. I need to experiment a bit more to
find the optimal approach. My web2py horizons are expanding daily.

On Dec 26, 3:43 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 Make a controller named system or global?

 --
 Thadeus

 On Sun, Dec 26, 2010 at 2:29 PM, weheh richard_gor...@verizon.net wrote:
  Of course, the other problem with using modules is that, especially
  with components, I really need to get to the global variable space.
  Yes, I can always pass global() and db to the module, but within the
  module, it makes the code bloat up a bit with constantly having to do
  global['session'].xyz and global['request'].args and such, which is an
  added pain.