[web2py] Re: Remote Interfacing with Web2Py

2011-06-27 Thread Arnon Marcus
Hi Massimo, 10x for replying so fast!
BTW, I agree with Jason, you ARE awesome! :)
Web2Py is a god-sent...

However, I did't understand some of the options you suggested.
Mainly I need a more accurate definition of them term your code.
My classifications is three-fold:
1. The web2py-application
2. A service running on the server along-side web2py
3. The service running locally that interacts with any of the above
remotely

What do you mean by your code in each of the 4 examples?
To which of the above codes does each of your examples apply?
Shouldn't there be an import of the DAL stuff in option 2?

What I tried to do now, was:
remote server web2py location\web2py.py -S appName -M -N -R my
bridge code.py
That tried to invoke a instance of the web2py app locally, which would
require all the pre-requisite modules used in that app to be installed
locally (such as the database python plugin, etc...)
Is there a way to do that, that would interface with the currently
running process, or launch a local one but would not require all the
dependent stuff?

What I want to do is have a bridging local process/service that it's
writing would be open and flexible to use any of the web2py/app
objects/classes/methods running on the server, without having to
decorate all the app's code and having to write glue-code for each
function in the client side.
Is that possible?

On Jun 26, 11:08 pm, Jason Brower encomp...@gmail.com wrote:
 Massimo is right and I support him.  No exec unless ABSOLUTELY needed,
 and I mean it. :P
 Running the web2py as a service does a good job.
  From what you say, you could do as massimo says and create a service to
 handle that special communication.
 Basically, I am just seconding Massimo cause he is awesome.
 ---
 Jason

 On 06/26/2011 08:32 PM, Massimo Di Pierro wrote:







  Please do not use exec_environment. Can you tell us more what kind of
  interface you need? What is the purpose?

  There are various way to interface and which one you use depend on the
  purpose:

  1)
  web2py.py -S app -M -N -R yourcode.py

  2)
   From your code
  db = DAL(...,path='/path/to/db',auto_import=True)

  3)
  expose a service, access the service (XML-RPC)

  4)
  queue tasks in db, access db and process tasks

  On Jun 26, 12:08 pm, Arnon Marcusa.m.mar...@gmail.com  wrote:
  Hi everybody,

  I'm searching for a way to interface into a web2py application, that
  does not use any of the built-in function-decorators.
  I want to write a service that would run locally, and interact with
  the web2py server, located on our company server, and serve as a
  common bridge for multiple local applications running on a user's
  machine.
  On the back-end sides of the service I got things covered.
  On it's front-side, the side that would talk to the web2py
  application, I was hoping to use something more flexible and open then
  xml-rpc or any of the rpc's...
  I was thinking on the lines of running an RPyC server along-side the
  web2py server, that would serve as a hub into the running process of
  the web2py application.
  I was also looking at Pyro, but the opinions about it where not great,
  compared to RPyC.
  I tried using the shell.py functionality, with no success.
  I couldn't even interface with the welcome application on a fresh code
  of web2py, via the web2py shell... It seems that something is broken
  there...
  I'm running from a command line, on the web2py folder:
     python web2py.py -S welcome -M -N
  The console/shell appears (the  stuff...)
  Then I do:
     from gluon.shell import exec_environment
  Then I tried:
     cas = exec_environment('applications/welcome/models/db.py')
  and
     other = exec_environment('applications/welcome/controllers/
  other.py')
  And they both throw me errors...

  And also, even if it did work, even though it should, theoretically,
  allow me to remotely use the DAL, it would be even more inefficient
  then using xml-rpc, as every user would have to remotely invoke an
  additional separate partial-web2py server process (if I understand the
  mechanism correctly...).

  Is there any efficient way to do what I need?


[web2py] Re: Remote Interfacing with Web2Py

2011-06-26 Thread Massimo Di Pierro
Please do not use exec_environment. Can you tell us more what kind of
interface you need? What is the purpose?

There are various way to interface and which one you use depend on the
purpose:

1)
web2py.py -S app -M -N -R yourcode.py

2)
From your code
db = DAL(...,path='/path/to/db',auto_import=True)

3)
expose a service, access the service (XML-RPC)

4)
queue tasks in db, access db and process tasks


On Jun 26, 12:08 pm, Arnon Marcus a.m.mar...@gmail.com wrote:
 Hi everybody,

 I'm searching for a way to interface into a web2py application, that
 does not use any of the built-in function-decorators.
 I want to write a service that would run locally, and interact with
 the web2py server, located on our company server, and serve as a
 common bridge for multiple local applications running on a user's
 machine.
 On the back-end sides of the service I got things covered.
 On it's front-side, the side that would talk to the web2py
 application, I was hoping to use something more flexible and open then
 xml-rpc or any of the rpc's...
 I was thinking on the lines of running an RPyC server along-side the
 web2py server, that would serve as a hub into the running process of
 the web2py application.
 I was also looking at Pyro, but the opinions about it where not great,
 compared to RPyC.
 I tried using the shell.py functionality, with no success.
 I couldn't even interface with the welcome application on a fresh code
 of web2py, via the web2py shell... It seems that something is broken
 there...
 I'm running from a command line, on the web2py folder:
   python web2py.py -S welcome -M -N
 The console/shell appears (the  stuff...)
 Then I do:
   from gluon.shell import exec_environment
 Then I tried:
   cas = exec_environment('applications/welcome/models/db.py')
 and
   other = exec_environment('applications/welcome/controllers/
 other.py')
 And they both throw me errors...

 And also, even if it did work, even though it should, theoretically,
 allow me to remotely use the DAL, it would be even more inefficient
 then using xml-rpc, as every user would have to remotely invoke an
 additional separate partial-web2py server process (if I understand the
 mechanism correctly...).

 Is there any efficient way to do what I need?


Re: [web2py] Re: Remote Interfacing with Web2Py

2011-06-26 Thread Jason Brower
Massimo is right and I support him.  No exec unless ABSOLUTELY needed, 
and I mean it. :P

Running the web2py as a service does a good job.
From what you say, you could do as massimo says and create a service to 
handle that special communication.

Basically, I am just seconding Massimo cause he is awesome.
---
Jason


On 06/26/2011 08:32 PM, Massimo Di Pierro wrote:

Please do not use exec_environment. Can you tell us more what kind of
interface you need? What is the purpose?

There are various way to interface and which one you use depend on the
purpose:

1)
web2py.py -S app -M -N -R yourcode.py

2)
 From your code
db = DAL(...,path='/path/to/db',auto_import=True)

3)
expose a service, access the service (XML-RPC)

4)
queue tasks in db, access db and process tasks


On Jun 26, 12:08 pm, Arnon Marcusa.m.mar...@gmail.com  wrote:

Hi everybody,

I'm searching for a way to interface into a web2py application, that
does not use any of the built-in function-decorators.
I want to write a service that would run locally, and interact with
the web2py server, located on our company server, and serve as a
common bridge for multiple local applications running on a user's
machine.
On the back-end sides of the service I got things covered.
On it's front-side, the side that would talk to the web2py
application, I was hoping to use something more flexible and open then
xml-rpc or any of the rpc's...
I was thinking on the lines of running an RPyC server along-side the
web2py server, that would serve as a hub into the running process of
the web2py application.
I was also looking at Pyro, but the opinions about it where not great,
compared to RPyC.
I tried using the shell.py functionality, with no success.
I couldn't even interface with the welcome application on a fresh code
of web2py, via the web2py shell... It seems that something is broken
there...
I'm running from a command line, on the web2py folder:
   python web2py.py -S welcome -M -N
The console/shell appears (the  stuff...)
Then I do:
   from gluon.shell import exec_environment
Then I tried:
   cas = exec_environment('applications/welcome/models/db.py')
and
   other = exec_environment('applications/welcome/controllers/
other.py')
And they both throw me errors...

And also, even if it did work, even though it should, theoretically,
allow me to remotely use the DAL, it would be even more inefficient
then using xml-rpc, as every user would have to remotely invoke an
additional separate partial-web2py server process (if I understand the
mechanism correctly...).

Is there any efficient way to do what I need?