diff options
author | Aaron Bentley <abentley@panoramicfeedback.com> | 2007-07-16 13:33:06 -0400 |
---|---|---|
committer | Aaron Bentley <abentley@panoramicfeedback.com> | 2007-07-16 13:33:06 -0400 |
commit | 6219c38d9c2bd6a8eeaf320ed0f1fa4bdf1b1fba (patch) | |
tree | 893d06dec46062df2146482e9dd9bf2b4d2bec7a /libbe/utility.py | |
parent | e8d004d66e6de5bb29cc874290d2114cb7146d51 (diff) | |
download | bugseverywhere-6219c38d9c2bd6a8eeaf320ed0f1fa4bdf1b1fba.tar.gz |
Add support for VISUAL
Diffstat (limited to 'libbe/utility.py')
-rw-r--r-- | libbe/utility.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libbe/utility.py b/libbe/utility.py index a8c3e24..1fd83da 100644 --- a/libbe/utility.py +++ b/libbe/utility.py @@ -104,16 +104,27 @@ def editor_string(comment=None): >>> if "EDITOR" in os.environ: ... del os.environ["EDITOR"] + >>> if "VISUAL" in os.environ: + ... del os.environ["VISUAL"] >>> editor_string() Traceback (most recent call last): CantFindEditor: Can't find editor to get string from >>> os.environ["EDITOR"] = "echo bar > " >>> editor_string() 'bar\\n' + >>> os.environ["VISUAL"] = "echo baz > " + >>> editor_string() + 'baz\\n' + >>> del os.environ["EDITOR"] + >>> del os.environ["VISUAL"] """ - try: - editor = os.environ["EDITOR"] - except KeyError: + for name in ('VISUAL', 'EDITOR'): + try: + editor = os.environ[name] + break + except KeyError: + pass + else: raise CantFindEditor() fhandle, fname = tempfile.mkstemp() try: |