Following up on this previous topic... thanks to those who responded.

It was very unfortunate that rexec is now considered unsafe, but I think I'll
proceed using it, in addition to some other security mechanisms.

Now, my question is about namespaces.  In a nutshell, from an XMLRPC servlet
method, I want to be able to 'exec' a (quasi-arbitrary) Python statement that
creates/assigns a new variable.  Then at a later time I want to be able to
refer to that variable.  So, I guess, essentially I want to update the
globals() list??

I was beginning to play with this TimeServlet:

from WebKit.XMLRPCServlet import XMLRPCServlet
#from time import *
import rexec
rex = rexec.RExec()
rex.ok_builtin_modules = ('errno', 'marshal', '_sre', 'time')
rex.r_exec('from time import *')


class TimeServlet(XMLRPCServlet):

  def exposedMethods(self):
    return ['execCmd', 'getVar']

  def execCmd(self,sarg):   # e.g.,  rpc.execCmd('mytime = str(time())')
    rex.r_exec(sarg)
    return 'ok'

  def getVar(self,sarg):  # return the value of some variable, e.g, 'mytime'
    return str(sarg)

Suggestions?

thanks,
--Randy


-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to