rexec in jython??

Mark Fink mark at mark-fink.de
Sun Feb 5 08:29:35 EST 2006


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)"




More information about the Python-list mailing list