diff --git a/CHANGELOG b/CHANGELOG index 975757d6..2445db2b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,15 @@ +Version 4.1.7 + + * Merge patches from Ville S: + * https://github.com/jasonrbriggs/stomp.py/pull/56 + * https://github.com/jasonrbriggs/stomp.py/pull/57 + + Version 4.1.6 - Aug 2015 * Generic exception catch on heartbeat send * Change default connection to the 1.2 protocol + * Fix timeout (https://github.com/jasonrbriggs/stomp.py/issues/55) Version 4.1.5 - Aug 2015 diff --git a/stomp/listener.py b/stomp/listener.py index 5a9b0baa..64bdef4a 100755 --- a/stomp/listener.py +++ b/stomp/listener.py @@ -223,7 +223,7 @@ def on_send(self, frame): """ Add the heartbeat header to the frame when connecting. """ - if frame.cmd == 'CONNECT' or frame.cmd == 'STOMP': + if frame.cmd == CMD_CONNECT or frame.cmd == CMD_STOMP: if self.heartbeats != (0, 0): frame.headers[HDR_HEARTBEAT] = '%s,%s' % self.heartbeats diff --git a/stomp/protocol.py b/stomp/protocol.py index 1533c247..cdf76206 100644 --- a/stomp/protocol.py +++ b/stomp/protocol.py @@ -49,7 +49,7 @@ def commit(self, transaction=None, headers={}, **keyword_headers): assert transaction is not None, "'transaction' is required" headers = utils.merge_headers([headers, keyword_headers]) headers[HDR_TRANSACTION] = transaction - self.send_frame('COMMIT', headers) + self.send_frame(CMD_COMMIT, headers) def connect(self, username=None, passcode=None, wait=False, headers={}, **keyword_headers): cmd = CMD_CONNECT @@ -155,7 +155,7 @@ def commit(self, transaction=None, headers={}, **keyword_headers): assert transaction is not None, "'transaction' is required" headers = utils.merge_headers([headers, keyword_headers]) headers[HDR_TRANSACTION] = transaction - self.send_frame('COMMIT', headers) + self.send_frame(CMD_COMMIT, headers) def connect(self, username=None, passcode=None, wait=False, headers={}, **keyword_headers): cmd = CMD_STOMP diff --git a/stomp/test/utils_test.py b/stomp/test/utils_test.py index 7746d89c..dec5a3de 100644 --- a/stomp/test/utils_test.py +++ b/stomp/test/utils_test.py @@ -10,7 +10,7 @@ def test_returns_true_when_localhost(self): self.assertEquals(2, is_localhost(('192.168.1.92', 8000))) def test_convert_frame_to_lines(self): - f = Frame('SEND', { 'header1' : 'value1'}, 'this is the body') + f = Frame('SEND', {'header1' : 'value1', 'headerNone': None}, 'this is the body') lines = convert_frame_to_lines(f) diff --git a/stomp/utils.py b/stomp/utils.py index 1e9f3465..db8efe20 100755 --- a/stomp/utils.py +++ b/stomp/utils.py @@ -167,6 +167,8 @@ def convert_frame_to_lines(frame): lines.append(frame.cmd) lines.append("\n") for key, vals in sorted(frame.headers.items()): + if vals is None: + continue if type(vals) != tuple: vals = (vals,) for val in vals: