aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/utility.py
diff options
context:
space:
mode:
authorAaron Bentley <abentley@panoramicfeedback.com>2007-07-16 13:33:06 -0400
committerAaron Bentley <abentley@panoramicfeedback.com>2007-07-16 13:33:06 -0400
commit6219c38d9c2bd6a8eeaf320ed0f1fa4bdf1b1fba (patch)
tree893d06dec46062df2146482e9dd9bf2b4d2bec7a /libbe/utility.py
parente8d004d66e6de5bb29cc874290d2114cb7146d51 (diff)
downloadbugseverywhere-6219c38d9c2bd6a8eeaf320ed0f1fa4bdf1b1fba.tar.gz
Add support for VISUAL
Diffstat (limited to 'libbe/utility.py')
-rw-r--r--libbe/utility.py17
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: