It may also be worth noting that you can get the output of another 
controller function within the *same *application via LOAD(..., ajax=False) 
(note, ajax=False is actually the default). This, however, will also 
execute the called function's view and return the full rendered output. In 
this case, the execution environment of the current request is re-used 
(i.e., it does not re-execute the models but simply runs the requested 
function in the current environment), which is why this does not work 
across applications. So, taking your example, you could do:

def order_plain():
    work_plain_response = LOAD('db_worker', 'work_plain')
    return "Hello %s" % work_plain_response

Anthony

On Saturday, February 18, 2017 at 9:00:23 AM UTC-5, Anthony wrote:
>
> Do you have a use case that cannot easily be accommodated by that pattern? 
>> If so, what do you imagine would be the API for doing what you want to do, 
>> and would it look much different from simply making an HTTP call (or 
>> possibly an RPC call) to the other app (which you can already do)?
>>
>
> And just to be clear, if you are OK with this:
>
> def order_plain():
>     othermod = gluon.shell.exec_environment(
> 'applications/test_env/controllers/db_worker.py')
>     return "Hello", othermod.work_plain()
>
> then why not this:
>
> def order_plain():
>     work_plain_response = gluon.tools.fetch(URL('db_worker', 'work_plain', 
> host='localhost'))
>     return "Hello %s" % work_plain_response
>
> Anthony
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to