Add support for VISUAL
authorAaron Bentley <abentley@panoramicfeedback.com>
Mon, 16 Jul 2007 17:33:06 +0000 (13:33 -0400)
committerAaron Bentley <abentley@panoramicfeedback.com>
Mon, 16 Jul 2007 17:33:06 +0000 (13:33 -0400)
.be/bugs/508ea95e-7bc6-4b9b-9e36-a3a87014423d/values
becommands/comment.py
libbe/utility.py

index a45d40ede07a459a0009f9ba45296d5a59d20ebe..f530d6341d96dbf810e2f381691b527c8ae9ce99 100644 (file)
@@ -15,7 +15,7 @@ severity=minor
 
 
 
-status=open
+status=closed
 
 
 
index 5f7128d2f60555bc99276cc42225b691b652b729..b211cf61debfeb77373b858ca4cef1c99ba9934f 100644 (file)
@@ -33,7 +33,8 @@ def execute(args):
     True
     >>> comment.in_reply_to is None
     True
-    >>> del os.environ["EDITOR"]
+    >>> if 'EDITOR' in os.environ:
+    ...     del os.environ["EDITOR"]
     >>> execute(["b"])
     Traceback (most recent call last):
     UserError: No comment supplied, and EDITOR not specified.
index a8c3e248ef025f866dcc25809df761093c7e6b9e..1fd83da8480ea08312646d3a91f3f4784f6a3082 100644 (file)
@@ -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: