summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@apache.org>2014-07-07 06:53:25 +0000
committerPavel Moravec <pmoravec@apache.org>2014-07-07 06:53:25 +0000
commite5ca946a0f1ff260a7ab7ad3732d4f35292cac44 (patch)
treeeda62c19d74dbb0268104c20c79898b05ffa0304 /python
parenta583dadecf9ce473fc778d5870a299a5a1261449 (diff)
downloadqpid-python-e5ca946a0f1ff260a7ab7ad3732d4f35292cac44.tar.gz
[QPID-5823]: Python client should create a node with name starting '\#'
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1608350 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python')
-rw-r--r--python/qpid/messaging/driver.py9
-rw-r--r--python/qpid/messaging/endpoints.py4
2 files changed, 12 insertions, 1 deletions
diff --git a/python/qpid/messaging/driver.py b/python/qpid/messaging/driver.py
index e8ab964f0e..6f1d0fba7d 100644
--- a/python/qpid/messaging/driver.py
+++ b/python/qpid/messaging/driver.py
@@ -29,6 +29,7 @@ from qpid.messaging import address, transports
from qpid.messaging.constants import UNLIMITED, REJECTED, RELEASED
from qpid.messaging.exceptions import *
from qpid.messaging.message import get_codec, Disposition, Message
+from qpid.messaging.endpoints import MangledString
from qpid.ops import *
from qpid.selector import Selector
from qpid.util import URL, default,get_client_properties_with_defaults
@@ -945,6 +946,14 @@ class Engine:
# XXX: subject
if lnk.options is None:
lnk.options = {}
+ if isinstance(addr, MangledString):
+ lnk.options['create'] = "always"
+ if 'node' not in lnk.options:
+ lnk.options['node'] = {}
+ if 'x-declare' not in lnk.options['node']:
+ lnk.options['node']['x-declare'] = {}
+ lnk.options['node']['x-declare']['auto-delete'] = "True"
+ lnk.options['node']['x-declare']['exclusive'] = "True"
except address.LexError, e:
return MalformedAddress(text=str(e))
except address.ParseError, e:
diff --git a/python/qpid/messaging/endpoints.py b/python/qpid/messaging/endpoints.py
index eb4c196ee8..5b10fbd9f1 100644
--- a/python/qpid/messaging/endpoints.py
+++ b/python/qpid/messaging/endpoints.py
@@ -778,9 +778,11 @@ class Session(Endpoint):
finally:
self.connection._remove_session(self)
+class MangledString(str): pass
+
def _mangle(addr):
if addr and addr.startswith("#"):
- return str(uuid4()) + addr
+ return MangledString(str(uuid4()) + addr)
else:
return addr