summaryrefslogtreecommitdiff
path: root/python/qpid/driver.py
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2010-01-25 13:12:51 +0000
committerRafael H. Schloming <rhs@apache.org>2010-01-25 13:12:51 +0000
commit44510813d26dca74622497b0217c730b779205b4 (patch)
tree9028252b4b1135dddeec55500d389097430f26a6 /python/qpid/driver.py
parentcdee35e16d30c13132a5c6b7ce5f84db2e5fdfd8 (diff)
downloadqpid-python-44510813d26dca74622497b0217c730b779205b4.tar.gz
verify that bindings are only specified for queues
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@902803 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/driver.py')
-rw-r--r--python/qpid/driver.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/python/qpid/driver.py b/python/qpid/driver.py
index c25b0dd67e..7d203de588 100644
--- a/python/qpid/driver.py
+++ b/python/qpid/driver.py
@@ -28,7 +28,7 @@ from ops import *
from selector import Selector
from threading import Condition, Thread
from util import connect
-from validator import Map, Types, Values
+from validator import And, Context, Map, Types, Values
log = getLogger("qpid.messaging")
rawlog = getLogger("qpid.messaging.io.raw")
@@ -584,6 +584,13 @@ class Driver:
POLICIES = Values("always", "sender", "receiver", "never")
+ class Bindings:
+
+ def validate(self, o, ctx):
+ t = ctx.containers[1].get("type", "queue")
+ if t != "queue":
+ return "bindings are only permitted on nodes of type queue"
+
OPTS = Map({
"create": POLICIES,
"delete": POLICIES,
@@ -593,14 +600,15 @@ class Driver:
"durable": Types(bool),
"x-properties": Map({
"type": Types(basestring),
- "bindings": Types(list)
+ "bindings": And(Types(list), Bindings())
},
restricted=False)
})
})
def validate_options(self, lnk):
- err = Driver.OPTS.validate(lnk.options)
+ ctx = Context()
+ err = Driver.OPTS.validate(lnk.options, ctx)
if err:
lnk.target.error = ("error in options: %s" % err,)
lnk.target.closed = True