Define editor_string(), a function that invokes an editor to accept user-produced text as a string.
>>> comment_string('hello') == comment_marker+"hello"
True
Invokes the editor, and returns the user-produced text as a string
>>> 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()
u'bar\n'
>>> os.environ["VISUAL"] = "echo baz > "
>>> editor_string()
u'baz\n'
>>> os.environ["VISUAL"] = "echo 'baz\n== Anything below this line will be ignored\nHi' > "
>>> editor_string()
u'baz\n'
>>> del os.environ["EDITOR"]
>>> del os.environ["VISUAL"]
>>> trimmed_string("hello\n"+comment_marker)
u'hello\n'
>>> trimmed_string("hi!\n" + comment_string('Booga'))
u'hi!\n'