From 5a2d0b7b2818a70ef4c077cf0d3f56431fed2507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl> Date: Mon, 26 Dec 2016 05:30:58 +0100 Subject: [PATCH] special case for frames --- coolamqp/framing/definitions.py | 5 +---- utils/compdefs.py | 7 ++++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/coolamqp/framing/definitions.py b/coolamqp/framing/definitions.py index 4abf4bc..14c8b3b 100644 --- a/coolamqp/framing/definitions.py +++ b/coolamqp/framing/definitions.py @@ -240,7 +240,7 @@ class ConnectionOpen(AMQPMethod): parts of the arguments section. :type out: callable(part_of_frame: binary type) -> nevermind """ - out(struct.pack('!pp?', self.virtual_host, u'', 0)) + out(struct.pack('!p?', self.virtual_host, 0)) class ConnectionOpenOk(AMQPMethod): @@ -277,7 +277,6 @@ class ConnectionOpenOk(AMQPMethod): parts of the arguments section. :type out: callable(part_of_frame: binary type) -> nevermind """ - out(struct.pack('!p', u'')) class ConnectionStart(AMQPMethod): @@ -837,7 +836,6 @@ class ChannelOpen(AMQPMethod): parts of the arguments section. :type out: callable(part_of_frame: binary type) -> nevermind """ - out(struct.pack('!p', u'')) class ChannelOpenOk(AMQPMethod): @@ -2029,7 +2027,6 @@ class BasicGetEmpty(AMQPMethod): parts of the arguments section. :type out: callable(part_of_frame: binary type) -> nevermind """ - out(struct.pack('!p', u'')) class BasicPublish(AMQPMethod): diff --git a/utils/compdefs.py b/utils/compdefs.py index 9786438..0c2e2f6 100644 --- a/utils/compdefs.py +++ b/utils/compdefs.py @@ -269,7 +269,12 @@ class AMQPMethod(object): if tp == 'longstr': line(' out(self.'+name_field(field.name)+')\n') else: - good_structs.append((BASIC_TYPES[tp][1], 'self.'+name_field(field.name) if not field.reserved else frepr(BASIC_TYPES[tp][2]))) + # special case - empty string + if tp == 'shortstr' and field.reserved: + continue # just skip :) + + val = 'self.'+name_field(field.name) if not field.reserved else frepr(BASIC_TYPES[tp][2], sop=six.binary_type) + good_structs.append((BASIC_TYPES[tp][1], val)) emit_structs(good_structs) line('\n') -- GitLab