Commit 81d1847c authored by Grégory Wisniewski's avatar Grégory Wisniewski

Rename _writeString to _encodeString for consistency.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1956 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent e3e6375e
...@@ -207,7 +207,7 @@ def _decodeString(buf, name, offset=0): ...@@ -207,7 +207,7 @@ def _decodeString(buf, name, offset=0):
raise PacketMalformedError("can't read string <%s>" % name) raise PacketMalformedError("can't read string <%s>" % name)
return (string, buf[offset+size:]) return (string, buf[offset+size:])
def _writeString(buf): def _encodeString(buf):
return pack('!L', len(buf)) + buf return pack('!L', len(buf)) + buf
class Packet(object): class Packet(object):
...@@ -339,7 +339,7 @@ class RequestIdentification(Packet): ...@@ -339,7 +339,7 @@ class RequestIdentification(Packet):
address = _encodeAddress(address) address = _encodeAddress(address)
return pack(self._header_format, PROTOCOL_VERSION[0], return pack(self._header_format, PROTOCOL_VERSION[0],
PROTOCOL_VERSION[1], node_type, uuid, address) + \ PROTOCOL_VERSION[1], node_type, uuid, address) + \
_writeString(name) _encodeString(name)
def _decode(self, body): def _decode(self, body):
r = unpack(self._header_format, body[:self._header_len]) r = unpack(self._header_format, body[:self._header_len])
...@@ -882,7 +882,7 @@ class AskStoreObject(Packet): ...@@ -882,7 +882,7 @@ class AskStoreObject(Packet):
if serial is None: if serial is None:
serial = INVALID_TID serial = INVALID_TID
return pack(self._header_format, oid, serial, tid, compression, return pack(self._header_format, oid, serial, tid, compression,
checksum) + _writeString(data) checksum) + _encodeString(data)
def _decode(self, body): def _decode(self, body):
header_len = self._header_len header_len = self._header_len
...@@ -994,7 +994,7 @@ class AnswerObject(Packet): ...@@ -994,7 +994,7 @@ class AnswerObject(Packet):
if serial_end is None: if serial_end is None:
serial_end = INVALID_TID serial_end = INVALID_TID
return pack(self._header_format, oid, serial_start, serial_end, return pack(self._header_format, oid, serial_start, serial_end,
compression, checksum) + _writeString(data) compression, checksum) + _encodeString(data)
def _decode(self, body): def _decode(self, body):
header_len = self._header_len header_len = self._header_len
...@@ -1478,7 +1478,7 @@ class Error(Packet): ...@@ -1478,7 +1478,7 @@ class Error(Packet):
_header_format = '!H' _header_format = '!H'
def _encode(self, code, message): def _encode(self, code, message):
return pack(self._header_format, code) + _writeString(message) return pack(self._header_format, code) + _encodeString(message)
def _decode(self, body): def _decode(self, body):
offset = self._header_len offset = self._header_len
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment