aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/command
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-12-13 06:19:23 -0500
committerW. Trevor King <wking@drexel.edu>2009-12-13 06:19:23 -0500
commit4d057dab603f42ec40b911dbee6792dcf107bd14 (patch)
tree9a73459aa160e3c96f4893b132543f412ca6e97f /libbe/command
parentdff6bd9bf89ca80e2265696a478e540476718c9c (diff)
downloadbugseverywhere-4d057dab603f42ec40b911dbee6792dcf107bd14.tar.gz
Converted libbe.storage.vcs.base to new Storage format.
Diffstat (limited to 'libbe/command')
-rw-r--r--libbe/command/base.py7
-rw-r--r--libbe/command/list.py16
2 files changed, 13 insertions, 10 deletions
diff --git a/libbe/command/base.py b/libbe/command/base.py
index 252dd24..52f193d 100644
--- a/libbe/command/base.py
+++ b/libbe/command/base.py
@@ -1,5 +1,6 @@
# Copyright
+import codecs
import optparse
import sys
@@ -168,7 +169,7 @@ class Command (object):
else: # non-arg options are flags, set to default flag value
params[option.name] = False
if len(options) > 0:
- raise UserError, 'Invalid options passed to command %s:\n %s' \
+ raise UserError, 'Invalid option passed to command %s:\n %s' \
% (self.name, '\n '.join(['%s: %s' % (k,v)
for k,v in options.items()]))
for arg in self.args:
@@ -190,9 +191,9 @@ class Command (object):
def _setup_io(self, input_encoding=None, output_encoding=None):
if input_encoding == None:
- input_encoding = libbe.util.get_input_encoding()
+ input_encoding = libbe.util.encoding.get_input_encoding()
if output_encoding == None:
- output_encoding = libbe.util.get_output_encoding()
+ output_encoding = libbe.util.encoding.get_output_encoding()
self.stdin = codecs.getwriter(input_encoding)(sys.stdin)
self.stdin.encoding = input_encoding
self.stdout = codecs.getwriter(output_encoding)(sys.stdout)
diff --git a/libbe/command/list.py b/libbe/command/list.py
index c835815..ce43ec9 100644
--- a/libbe/command/list.py
+++ b/libbe/command/list.py
@@ -129,6 +129,7 @@ class List (libbe.command.Command):
# ])
def _run(self, bugdir, **params):
+ bugdir.storage.writeable = False
cmp_list, status, severity, assigned, extra_strings_regexps = \
self._parse_params(params)
filter = Filter(status, severity, assigned, extra_strings_regexps)
@@ -136,7 +137,7 @@ class List (libbe.command.Command):
bugs = [b for b in bugs if filter(b) == True]
self.result = bugs
if len(bugs) == 0 and params['xml'] == False:
- print "No matching bugs found"
+ print >> self.stdout, "No matching bugs found"
# sort bugs
bugs = self._sort_bugs(bugs, cmp_list)
@@ -144,7 +145,7 @@ class List (libbe.command.Command):
# print list of bugs
if params['uuids'] == True:
for bug in bugs:
- print bug.uuid
+ print >> self.stdout, bug.uuid
else:
self._list_bugs(bugs, xml=params['xml'])
@@ -205,16 +206,17 @@ class List (libbe.command.Command):
def _list_bugs(self, bugs, xml=False):
if xml == True:
- print '<?xml version="1.0" encoding="%s" ?>' % self.stdout.encoding
- print "<bugs>"
+ print >> self.stdout, \
+ '<?xml version="1.0" encoding="%s" ?>' % self.stdout.encoding
+ print >> self.stdout, '<bugs>'
if len(bugs) > 0:
for bug in bugs:
if xml == True:
- print bug.xml(show_comments=True)
+ print >> self.stdout, bug.xml(show_comments=True)
else:
- print bug.string(shortlist=True)
+ print >> self.stdout, bug.string(shortlist=True)
if xml == True:
- print "</bugs>"
+ print >> self.stdout, '</bugs>'
def _long_help(self):
return """