summaryrefslogtreecommitdiff
path: root/python/examples
diff options
context:
space:
mode:
authorJustin Ross <jross@apache.org>2013-04-23 21:16:04 +0000
committerJustin Ross <jross@apache.org>2013-04-23 21:16:04 +0000
commit5636a3b148b8e8dbdc17cfc4a68da276e7c82ed1 (patch)
tree16e27369a6b7d9bad85fd84d05254680aee3db91 /python/examples
parent5e766541328153118de91ced8cd473fd4d74fe91 (diff)
downloadqpid-python-5636a3b148b8e8dbdc17cfc4a68da276e7c82ed1.tar.gz
QPID-4772: Assume text/plain for content type if no other indication is given; a patch from Ernie Allen
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1471146 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/examples')
-rwxr-xr-xpython/examples/api/spout6
1 files changed, 6 insertions, 0 deletions
diff --git a/python/examples/api/spout b/python/examples/api/spout
index c2dc4db380..e4d7cfb970 100755
--- a/python/examples/api/spout
+++ b/python/examples/api/spout
@@ -75,6 +75,7 @@ else:
parser.error("address is required")
content = None
+content_type = None
if args:
text = " ".join(args)
@@ -90,6 +91,9 @@ if opts.entries:
content[name] = val
else:
content = text
+ # no entries were supplied, so assume text/plain for
+ # compatibility with java (and other) clients
+ content_type = "text/plain"
conn = Connection(opts.broker,
reconnect=opts.reconnect,
@@ -107,6 +111,8 @@ try:
msg = Message(subject=opts.subject,
reply_to=opts.reply_to,
content=content)
+ if content_type is not None:
+ msg.content_type = content_type
msg.properties["spout-id"] = "%s:%s" % (spout_id, count)
for p in opts.properties:
name, val = nameval(p)