def monkey_compiler(self, *args, **kw): if self._body: # only do something if we have a body to play with if aq_parent(self) is None: # we have a body but no acquisiton context, # we're either something to do with an # FSPythonScript, or being called from within # __setstate__ due to a change in Python_magic or Script_magic # try and find an FSPythonScript in our call stack try: raise ZeroDivisionError except ZeroDivisionError: f = sys.exc_info()[2].tb_frame while f: obj = f.f_locals.get('self') if isinstance(obj,FSPythonScript): break f = f.f_back if f is None: filename = 'Python Script without Acquisition Context' else: filename = '/'.join(obj.getPhysicalPath()) else: filename = '/'.join(self.getPhysicalPath()) args = list(args) args[3]=filename return RestrictedPython.compile_restricted_function(*args, **kw)
def monkey_compiler(self, *args, **kw): if self._body: # only do something if we have a body to play with if aq_parent(self) is None: # we have a body but no acquisiton context, # we're either something to do with an # FSPythonScript, or being called from within # __setstate__ due to a change in Python_magic or Script_magic # try and find an FSPythonScript in our call stack try: raise ZeroDivisionError except ZeroDivisionError: f = sys.exc_info()[2].tb_frame while f: obj = f.f_locals.get("self") if isinstance(obj, FSPythonScript): break f = f.f_back if f is None: filename = "Python Script without Acquisition Context" else: filename = "/".join(obj.getPhysicalPath()) else: filename = "/".join(self.getPhysicalPath()) args = list(args) args[3] = filename return RestrictedPython.compile_restricted_function(*args, **kw)
def _compiler(self, *args, **kw): return RestrictedPython.compile_restricted_function(*args, **kw)
def _compiler(self, *args, **kw): return RestrictedPython.compile_restricted_function(*args, **kw)