From d22ac4bbbd52fc8cbf80f864c49c904b0b24a529 Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Tue, 11 Aug 2009 15:40:19 +0000 Subject: - removed old and redundent tests - removed old test harness in favor of qpid-python-test - modified qpid-python-test to support "skipped" tests, these are tests that failed due to an anticipated environmental reason such as the broker is not running or it is the wrong version - modified the qpid-python-test harness to exit with appropriate error codes based on the test results - modified the python clients to report version mismatches rather than framing errors - made qpid_config provide variables for 0-8, 0-9, and 0-10 versions of the spec - modified the 0-10 client to directly codegen classes - added new 0-10 framing layer based on push parsing rather than pull parsing - added numerous framing tests git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@803168 13f79535-47bb-0310-9956-ffa450edef68 --- python/qpid/messaging.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'python/qpid/messaging.py') diff --git a/python/qpid/messaging.py b/python/qpid/messaging.py index f06ef87709..9b3fecbf9b 100644 --- a/python/qpid/messaging.py +++ b/python/qpid/messaging.py @@ -34,8 +34,8 @@ import connection, time, socket, sys, traceback from codec010 import StringCodec from datatypes import timestamp, uuid4, RangedSet, Message as Message010 from logging import getLogger +from ops import PRIMITIVE from session import Client, INCOMPLETE -from spec import SPEC from threading import Thread, RLock, Condition from util import connect @@ -191,9 +191,12 @@ class Connection(Lockable): try: self._socket = connect(self.host, self.port) except socket.error, e: - raise ConnectError(*e.args) + raise ConnectError(e) self._conn = connection.Connection(self._socket) - self._conn.start() + try: + self._conn.start() + except connection.VersionError, e: + raise ConnectError(e) for ssn in self.sessions.values(): ssn._attach() @@ -263,8 +266,8 @@ FILTER_DEFAULTS = { def delegate(session): class Delegate(Client): - def message_transfer(self, cmd, headers, body): - session._message_transfer(cmd, headers, body) + def message_transfer(self, cmd): + session._message_transfer(cmd) return Delegate class Session(Lockable): @@ -314,9 +317,9 @@ class Session(Lockable): link._disconnected() @synchronized - def _message_transfer(self, cmd, headers, body): - m = Message010(body) - m.headers = headers + def _message_transfer(self, cmd): + m = Message010(cmd.payload) + m.headers = cmd.headers m.id = cmd.id msg = self._decode(m) rcv = self.receivers[int(cmd.destination)] @@ -812,16 +815,16 @@ class Receiver(Lockable): def codec(name): - type = SPEC.named[name] + type = PRIMITIVE[name] def encode(x): - sc = StringCodec(SPEC) - type.encode(sc, x) + sc = StringCodec() + sc.write_primitive(type, x) return sc.encoded def decode(x): - sc = StringCodec(SPEC, x) - return type.decode(sc) + sc = StringCodec(x) + return sc.read_primitive(type) return encode, decode -- cgit v1.2.1