summaryrefslogtreecommitdiff
path: root/qpid/python/commands
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2008-11-11 16:52:44 +0000
committerTed Ross <tross@apache.org>2008-11-11 16:52:44 +0000
commit3d00ce05395f5196ae576762090db2a6f701fc42 (patch)
treed50fbe0c37d0881ffba468d129bf996fb0031cd9 /qpid/python/commands
parent6b462117f241dda56256967a36497965643ff306 (diff)
downloadqpid-python-3d00ce05395f5196ae576762090db2a6f701fc42.tar.gz
QPID-1448 - Management APIs and CLI tools are not unicode safe
The management APIs (old and new) now use unicode strings as the default. The CLI utilities now use the preferred shell encoding to support multibyte characters in the command line and in managed objects. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@713079 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python/commands')
-rwxr-xr-xqpid/python/commands/qpid-config10
-rwxr-xr-xqpid/python/commands/qpid-route17
2 files changed, 21 insertions, 6 deletions
diff --git a/qpid/python/commands/qpid-config b/qpid/python/commands/qpid-config
index 6917d4c5c0..e2d3108a33 100755
--- a/qpid/python/commands/qpid-config
+++ b/qpid/python/commands/qpid-config
@@ -22,6 +22,7 @@
import os
import getopt
import sys
+import locale
from qpid import qmfconsole
_recursive = False
@@ -305,10 +306,16 @@ try:
longOpts = ("durable", "cluster-durable", "bindings", "broker-addr=", "file-count=",
"file-size=", "max-queue-size=", "max-queue-count=", "policy-type=",
"last-value-queue", "optimistic-consume", "sequence", "ive")
- (optlist, cargs) = getopt.gnu_getopt (sys.argv[1:], "a:b", longOpts)
+ (optlist, encArgs) = getopt.gnu_getopt (sys.argv[1:], "a:b", longOpts)
except:
Usage ()
+try:
+ encoding = locale.getpreferredencoding()
+ cargs = [a.decode(encoding) for a in encArgs]
+except:
+ cargs = encArgs
+
for opt in optlist:
if opt[0] == "-b" or opt[0] == "--bindings":
_recursive = True
@@ -381,6 +388,7 @@ try:
Usage ()
except Exception,e:
print "Failed:", e.message
+ raise
sys.exit(1)
bm.Disconnect()
diff --git a/qpid/python/commands/qpid-route b/qpid/python/commands/qpid-route
index e64889b2af..6fbd11b684 100755
--- a/qpid/python/commands/qpid-route
+++ b/qpid/python/commands/qpid-route
@@ -23,6 +23,7 @@ import getopt
import sys
import socket
import os
+import locale
from qpid import qmfconsole
def Usage():
@@ -116,11 +117,11 @@ class RouteManager:
print "No Links Found"
else:
print
- print "Host Port Durable State Last Error"
- print "==================================================================="
+ print "Host Port Transport Durable State Last Error"
+ print "============================================================================="
for link in links:
- print "%-16s%-8d %c %-18s%s" % \
- (link.host, link.port, YN(link.durable), link.state, link.lastError)
+ print "%-16s%-8d%-13s%c %-18s%s" % \
+ (link.host, link.port, link.transport, YN(link.durable), link.state, link.lastError)
def mapRoutes(self):
qmf = self.qmf
@@ -401,10 +402,16 @@ def YN(val):
try:
longOpts = ("verbose", "quiet", "durable", "del-empty-link", "src-local", "transport=")
- (optlist, cargs) = getopt.gnu_getopt(sys.argv[1:], "vqdest:", longOpts)
+ (optlist, encArgs) = getopt.gnu_getopt(sys.argv[1:], "vqdest:", longOpts)
except:
Usage()
+try:
+ encoding = locale.getpreferredencoding()
+ cargs = [a.decode(encoding) for a in encArgs]
+except:
+ cargs = encArgs
+
for opt in optlist:
if opt[0] == "-v" or opt[0] == "--verbose":
_verbose = True