[Zope-CVS] CVS: Products/ExternalEditor - CHANGES.txt:1.4 INSTALL.txt:1.2 zopeedit.py:1.4
Casey Duncan
casey@zope.com
Fri, 24 May 2002 15:16:18 -0400
Update of /cvs-repository/Products/ExternalEditor
In directory cvs.zope.org:/tmp/cvs-serv17734
Modified Files:
CHANGES.txt INSTALL.txt zopeedit.py
Log Message:
Minor bug fixes
=== Products/ExternalEditor/CHANGES.txt 1.3 => 1.4 ===
+ - Removed implicit save in Configuration class destructor
+
- Added caching headers to prevent client-side caching of edit data.
Thanks to Gabriel Genellina for pointing this out.
=== Products/ExternalEditor/INSTALL.txt 1.1.1.1 => 1.2 ===
- for Application, select the helper application python file
-
+ Tips
+
+ The helper application can run any graphical editor that does not detach
+ itself from the controlling process.
+
+ To get terminal editors to work, you need to create a small shell script to
+ spawn them inside an xterm. For example, the following short shell script
+ fires up vi in an xterm and passes it the file to edit::
+
+ #!/bin/sh
+ xterm -e vi "$@"
+
+ You can of course modify the above to fire up your favorite editor or add
+ any command line arguments you want.
+
+ Specify the shell script as the editor (in ~/.zope-external-edit) and you
+ should be good to go.
+
+ As for editors that insist on detaching from the controlling process (gvim
+ does this by default), you need to configure them so that they do not do
+ this. (The -f option turns this off for gvim).
+
+ Troubleshooting
+
+ If the helper app won't launch try the following suggestions:
+
+ - Make sure you have Tk installed properly. To test this, bring up Python
+ in a terminal and enter 'import Tkinter'. If it throws an exception,
+ that is your problem.
+
+ - Netscape 4 users, add a "%s" at the end of the application command line.
+ It appears the Netscape likes to alert you with spurious things coming
+ from stderr. I'll see if I can come up with a solution to that.
+
+ - Make sure the file is marked as executable for your user ('chmod +x zopeedit.py' should do it)
+
+ - Make sure the first line of the helper app file points to the correct
+ path to your Python binary (the default is '/usr/local/bin/python' which
+ may not be correct on all systems)
+
+ - Make sure the browser is properly configured. Use a full path to the
+ helper app.
+
+ - Make sure you are using a graphical editor (that uses X windows). To use
+ a terminal based editor (like vi), create a shell script that spawns it
+ inside an xterm. See tips above.
+
+ - Try downloading and saving the external editor data to a file manually
+ (right click on the pencil icon). Then try running the helper app from
+ the command line, passing it the path to this file. If it runs, then
+ there is something wrong with the browser configuration. If not, then it
+ should output a traceback to your terminal. Email me a copy of this
+ traceback, and the data file and I will try to fix it.
+
+ - If the editor launches, but the helper app complains that it didn't, its
+ probably because your editor detached from the parent process (the helper
+ app). Configure the editor such that it does not do this. Unfortunately
+ this prevents you from using a multi-headed text edit server (like nedit
+ and emacs can provide). This is a limitation I have not found a way
+ around yet (any ideas??)
+
+
=== Products/ExternalEditor/zopeedit.py 1.3 => 1.4 ===
self.config = ConfigParser()
self.config.readfp(open(path))
-
-
- def __del__(self):
- # Save changes on destruction
- if self.changed:
- self.save()
def save(self):
"""Save config options to disk"""
self.config.write(open(self.path, 'w'))
self.changed = 0
-
def set(self, section, option, value):
self.config.set(section, option, value)
@@ -107,11 +100,11 @@
body_file = body_file + ext
body_f = open(body_file, 'wb')
body_f.write(in_f.read())
+ self.body_file = body_file
in_f.close()
body_f.close()
self.clean_up = int(self.options.get('cleanup_files', 1))
if self.clean_up: os.remove(input_file)
- self.body_file = body_file
except:
# for security, always delete the input file even if
# a fatal error occurs, unless explicitly stated otherwise
@@ -133,7 +126,7 @@
def __del__(self):
# for security we always delete the files by default
- if getattr(self, 'clean_up', 1):
+ if getattr(self, 'clean_up', 1) and hasattr(self, 'body_file'):
os.remove(self.body_file)
def getEditorPath(self):
@@ -164,7 +157,7 @@
if path is not None:
return path
else:
- self.fatalError('Editor not found at "%s"' % path)
+ fatalError('Editor not found at "%s"' % path)
def launch(self):
"""Launch external editor"""