[Tutor] rexec-environ
Michael P. Reilly
arcege@speakeasy.net
Wed, 18 Jul 2001 08:54:38 -0400 (EDT)
Risto Peranen wrote
> Hey all. I'm still making a game which I need your help once again.
> We are planning to do python applets for the game. That's way everyone
> can extend our engine very easily. I have read rexec-howto and it's seems
> quite nice for our purposes but how can one make more restricted
> environment. Since game will run also win32-platforms it's important that
> applets may not open files. How do you do that (with rexec(?))?
By default, a RExec instance allows you to open files for reading only.
But that is handled by a r_open method that you can override in a
subclass.
class NoOpenRExec(RExec):
def r_open(self, file, mode='r', buf=-1):
raise IOError, "can't open files in restricted mode"
This method is set as the built-in 'open' function in the rexec
environment.
-Arcege
--
+----------------------------------+-----------------------------------+
| Michael P. Reilly | arcege@speakeasy.net |