rexec in jython??
Diez B. Roggisch
deets at nospam.web.de
Sun Feb 5 08:31:00 EST 2006
Mark Fink wrote:
> This is the original code section of the library including the
> comments:
> class AutoAdapter(TypeAdapter):
> """
> This adapter returns a type based on the format of the table cell
> contents, following python's rules for literals (plus a few
> others).
> We could fall back on this when we don't know what type is
> expected.
> I am lazy and so use rexec to do the work.
>
> #Note: The RExec class can prevent code from performing unsafe
> #operations like reading or writing disk files, or using TCP/IP
> #sockets. However, it does not protect against code using
> #extremely large amounts of memory or processor time.
> """
> r_eval = RExec().r_eval
> def parse(self,s):
> if s.strip().lower() == 'true':
> return 1
> elif s.strip().lower() == 'false':
> return 0
> else:
> try:
> return self.r_eval(s)
> except SystemExit:
> return None
> except:
> return s
>
> I completely removed the import of rexec and replaced "return
> self.r_eval(s)" with "return self.eval(s)"
And what does self.eval look like? Crystal ball still not working....
Diez
More information about the Python-list
mailing list