From dfb7878b674e8eed1cfa55928d5464dc6fb0f085 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 16 Jul 2009 05:50:31 -0400 Subject: Renamed test->manipulate_encodings in becommands.*.execute. Reminder from my initial libbe/encoding.py commit: Because of the stdout replacement, the doctests executes now need an optional 'test' argument to turn off replacement during the doctests, otherwise doctest flips out (since it had set up stdout to catch output, and then we clobbered it's setup). I'm also trying to catch stdout/stderr from be-handle-mail, and I ran into the same problem. It took me a bit to remember exactly what "test" was supposed to do, so I thought I'd make the argument name more specific. If you need other changes when running in "test" mode, you'll have to add other kwargs. --- libbe/cmdutil.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libbe/cmdutil.py') diff --git a/libbe/cmdutil.py b/libbe/cmdutil.py index 36d5d96..e9c16ed 100644 --- a/libbe/cmdutil.py +++ b/libbe/cmdutil.py @@ -70,10 +70,11 @@ def get_command(command_name): return cmd -def execute(cmd, args): +def execute(cmd, args, manipulate_encodings=True): enc = encoding.get_encoding() cmd = get_command(cmd) - cmd.execute([a.decode(enc) for a in args]) + cmd.execute([a.decode(enc) for a in args], + manipulate_encodings=manipulate_encodings) return 0 def help(cmd=None, parser=None): -- cgit From 4e8882e74aad64859a16f17fa6bef8c04b33913d Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 29 Jul 2009 15:46:37 -0400 Subject: Added clean messages on bug_from_shortname failure. So user's don't get confused. --- libbe/cmdutil.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libbe/cmdutil.py') diff --git a/libbe/cmdutil.py b/libbe/cmdutil.py index 853a75a..35d2f9e 100644 --- a/libbe/cmdutil.py +++ b/libbe/cmdutil.py @@ -206,6 +206,15 @@ def underlined(instring): return "%s\n%s" % (instring, "="*len(instring)) +def bug_from_shortname(bugdir, shortname): + """ + Exception translation for the command-line interface. + """ + try: + bug = bugdir.bug_from_shortname(shortname) + except (bugdir.MultipleBugMatches, bugdir.NoBugMatches), e: + raise UserError(e.message) + return bug def _test(): import doctest -- cgit From 027cda3613f7a81de557d6dd929d0d4de40192a1 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 31 Aug 2009 14:19:40 -0400 Subject: Added docstrings to libbe submodules. Also a few minor tweaks to the module imports. --- libbe/cmdutil.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libbe/cmdutil.py') diff --git a/libbe/cmdutil.py b/libbe/cmdutil.py index 94a6856..8c1c612 100644 --- a/libbe/cmdutil.py +++ b/libbe/cmdutil.py @@ -15,6 +15,11 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +""" +Define assorted utilities to make command-line handling easier. +""" + import glob import optparse import os -- cgit From b910115f83a697cef38dd91c76b40c3a49954044 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 23 Sep 2009 10:07:38 -0400 Subject: Fixed bugdir name collision in cmdutil.bug_from_shortname() --- libbe/cmdutil.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libbe/cmdutil.py') diff --git a/libbe/cmdutil.py b/libbe/cmdutil.py index 8c1c612..9b64142 100644 --- a/libbe/cmdutil.py +++ b/libbe/cmdutil.py @@ -212,12 +212,12 @@ def underlined(instring): return "%s\n%s" % (instring, "="*len(instring)) -def bug_from_shortname(bugdir, shortname): +def bug_from_shortname(bdir, shortname): """ Exception translation for the command-line interface. """ try: - bug = bugdir.bug_from_shortname(shortname) + bug = bdir.bug_from_shortname(shortname) except (bugdir.MultipleBugMatches, bugdir.NoBugMatches), e: raise UserError(e.message) return bug -- cgit