From 12a948ddf009fb2510eda5be4f576dc3e7de401f Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 29 Jan 2010 07:32:41 -0500 Subject: Fix editor spawning on null-string EDITOR and VISUAL. $ EDITOR= VISUAL= python -c 'import os; import sys; print os.environ' {..., 'EDITOR': '', ..., 'VISUAL': '', ...} --- libbe/ui/util/editor.py | 7 +++---- 1 file 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: -- cgit