zope2/ScriptDebugging

changeset 10:a33284e83d4d

Some bugfixes from Stephan Deibel
author lregebro
date Thu, 24 Feb 2005 11:08:11 +0000
parents a66c5e65ea3d
children 88e0748d0bc5
files __init__.py
diffstat 1 files changed, 14 insertions(+), 9 deletions(-) [+]
line diff
     1.1 --- a/__init__.py
     1.2 +++ b/__init__.py
     1.3 @@ -19,10 +19,8 @@
     1.4  
     1.5  from Shared.DC.Scripts.Script import defaultBindings
     1.6  
     1.7 -from Products.CMFCore.FSPythonScript import FSPythonScript, bad_func_code
     1.8  from Products.PythonScripts.PythonScript import PythonScript, Python_magic, \
     1.9 -    Script_magic, _nonempty_line, _first_indent
    1.10 -from Products.CMFCore.DirectoryView import expandpath
    1.11 +    Script_magic, _nonempty_line, _first_indent, _nice_bind_names
    1.12  
    1.13  from AccessControl import ModuleSecurityInfo
    1.14  ModuleSecurityInfo('pdb').declarePublic('set_trace')
    1.15 @@ -186,17 +184,24 @@
    1.16  
    1.17  PythonScript.read = read
    1.18  
    1.19 -# Now includes the filepath
    1.20 -def _createZODBClone(self):
    1.21 +try:
    1.22 +    from Products.CMFCore.FSPythonScript import FSPythonScript
    1.23 +    from Products.CMFCore.DirectoryView import expandpath
    1.24 +except ImportError:
    1.25 +    pass
    1.26 +else:
    1.27 +    
    1.28 +    # Now includes the filepath
    1.29 +    def _createZODBClone(self):
    1.30      """Create a ZODB (editable) equivalent of this object."""
    1.31      obj = PythonScript(self.getId(), expandpath(self._filepath))
    1.32      obj.write(self.read())
    1.33      return obj
    1.34  
    1.35 -FSPythonScript._createZODBClone = _createZODBClone
    1.36 +    FSPythonScript._createZODBClone = _createZODBClone
    1.37  
    1.38 -# Now includes the file path
    1.39 -def _write(self, text, compile):
    1.40 +    # Now includes the file path
    1.41 +    def _write(self, text, compile):
    1.42      '''
    1.43      Parses the source, storing the body, params, title, bindings,
    1.44      and source in self.  If compile is set, compiles the
    1.45 @@ -221,4 +226,4 @@
    1.46      self._setupBindings(ps.getBindingAssignments().getAssignedNames())
    1.47      self._source = ps.read()  # Find out what the script sees.
    1.48  
    1.49 -FSPythonScript._write =_write
    1.50 +    FSPythonScript._write =_write