aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2010-01-29 07:32:41 -0500
committerW. Trevor King <wking@drexel.edu>2010-01-29 07:32:41 -0500
commit12a948ddf009fb2510eda5be4f576dc3e7de401f (patch)
tree4de86d5d9819447f186fa457f4458835ece931cc /libbe
parentdcd4b86abb46f5763de1ac1b57d3bf4a9891c4a3 (diff)
downloadbugseverywhere-12a948ddf009fb2510eda5be4f576dc3e7de401f.tar.gz
Fix editor spawning on null-string EDITOR and VISUAL.
$ EDITOR= VISUAL= python -c 'import os; import sys; print os.environ' {..., 'EDITOR': '', ..., 'VISUAL': '', ...}
Diffstat (limited to 'libbe')
-rw-r--r--libbe/ui/util/editor.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/libbe/ui/util/editor.py b/libbe/ui/util/editor.py
index ce14365..1a430c7 100644
--- a/libbe/ui/util/editor.py
+++ b/libbe/ui/util/editor.py
@@ -64,13 +64,12 @@ def editor_string(comment=None, encoding=None):
"""
if encoding == None:
encoding = libbe.util.encoding.get_filesystem_encoding()
+ editor = None
for name in ('VISUAL', 'EDITOR'):
- try:
+ if name in os.environ and os.environ[name] != '':
editor = os.environ[name]
break
- except KeyError:
- pass
- else:
+ if editor == None:
raise CantFindEditor()
fhandle, fname = tempfile.mkstemp()
try: